use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project spring-boot by spring-projects.
the class PersistenceExceptionTranslationAutoConfiguration method persistenceExceptionTranslationPostProcessor.
@Bean
@ConditionalOnMissingBean(PersistenceExceptionTranslationPostProcessor.class)
@ConditionalOnProperty(prefix = "spring.dao.exceptiontranslation", name = "enabled", matchIfMissing = true)
public static PersistenceExceptionTranslationPostProcessor persistenceExceptionTranslationPostProcessor() {
PersistenceExceptionTranslationPostProcessor postProcessor = new PersistenceExceptionTranslationPostProcessor();
postProcessor.setProxyTargetClass(true);
return postProcessor;
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project spring-boot by spring-projects.
the class MongoDataAutoConfiguration method mongoMappingContext.
@Bean
@ConditionalOnMissingBean
public MongoMappingContext mongoMappingContext(BeanFactory beanFactory, CustomConversions conversions) throws ClassNotFoundException {
MongoMappingContext context = new MongoMappingContext();
context.setInitialEntitySet(new EntityScanner(this.applicationContext).scan(Document.class, Persistent.class));
Class<?> strategyClass = this.properties.getFieldNamingStrategy();
if (strategyClass != null) {
context.setFieldNamingStrategy((FieldNamingStrategy) BeanUtils.instantiateClass(strategyClass));
}
context.setSimpleTypeHolder(conversions.getSimpleTypeHolder());
return context;
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project spring-boot by spring-projects.
the class SendGridAutoConfiguration method sendGrid.
@Bean
@ConditionalOnMissingBean(SendGrid.class)
public SendGrid sendGrid() {
SendGrid sendGrid = createSendGrid();
if (this.properties.isProxyConfigured()) {
HttpHost proxy = new HttpHost(this.properties.getProxy().getHost(), this.properties.getProxy().getPort());
sendGrid.setClient(HttpClientBuilder.create().setProxy(proxy).setUserAgent("sendgrid/" + sendGrid.getVersion() + ";java").build());
}
return sendGrid;
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project spring-boot by spring-projects.
the class AtomikosJtaConfiguration method userTransactionService.
@Bean(initMethod = "init", destroyMethod = "shutdownForce")
@ConditionalOnMissingBean(UserTransactionService.class)
public UserTransactionServiceImp userTransactionService(AtomikosProperties atomikosProperties) {
Properties properties = new Properties();
if (StringUtils.hasText(this.jtaProperties.getTransactionManagerId())) {
properties.setProperty("com.atomikos.icatch.tm_unique_name", this.jtaProperties.getTransactionManagerId());
}
properties.setProperty("com.atomikos.icatch.log_base_dir", getLogBaseDir());
properties.putAll(atomikosProperties.asProperties());
return new UserTransactionServiceImp(properties);
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project spring-boot by spring-projects.
the class BitronixJtaConfiguration method bitronixConfiguration.
@Bean
@ConditionalOnMissingBean
@ConfigurationProperties(prefix = "spring.jta.bitronix.properties")
public bitronix.tm.Configuration bitronixConfiguration() {
bitronix.tm.Configuration config = TransactionManagerServices.getConfiguration();
if (StringUtils.hasText(this.jtaProperties.getTransactionManagerId())) {
config.setServerId(this.jtaProperties.getTransactionManagerId());
}
File logBaseDir = getLogBaseDir();
config.setLogPart1Filename(new File(logBaseDir, "part1.btm").getAbsolutePath());
config.setLogPart2Filename(new File(logBaseDir, "part2.btm").getAbsolutePath());
config.setDisableJmx(true);
return config;
}
Aggregations