use of org.springframework.context.annotation.Bean 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.context.annotation.Bean 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;
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class ValidationAutoConfiguration method methodValidationPostProcessor.
@Bean
@ConditionalOnMissingBean
public static MethodValidationPostProcessor methodValidationPostProcessor(Validator validator) {
MethodValidationPostProcessor processor = new MethodValidationPostProcessor();
processor.setProxyTargetClass(true);
processor.setValidator(validator);
return processor;
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class EmbeddedMongoAutoConfiguration method embeddedMongoConfiguration.
@Bean
@ConditionalOnMissingBean
public IMongodConfig embeddedMongoConfiguration() throws IOException {
IFeatureAwareVersion featureAwareVersion = new ToStringFriendlyFeatureAwareVersion(this.embeddedProperties.getVersion(), this.embeddedProperties.getFeatures());
MongodConfigBuilder builder = new MongodConfigBuilder().version(featureAwareVersion);
if (this.embeddedProperties.getStorage() != null) {
builder.replication(new Storage(this.embeddedProperties.getStorage().getDatabaseDir(), this.embeddedProperties.getStorage().getReplSetName(), this.embeddedProperties.getStorage().getOplogSize() != null ? this.embeddedProperties.getStorage().getOplogSize() : 0));
}
Integer configuredPort = this.properties.getPort();
if (configuredPort != null && configuredPort > 0) {
builder.net(new Net(getHost().getHostAddress(), configuredPort, Network.localhostIsIPv6()));
} else {
builder.net(new Net(getHost().getHostAddress(), Network.getFreeServerPort(getHost()), Network.localhostIsIPv6()));
}
return builder.build();
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class JpaBaseConfiguration method entityManagerFactoryBuilder.
@Bean
@ConditionalOnMissingBean
public EntityManagerFactoryBuilder entityManagerFactoryBuilder(JpaVendorAdapter jpaVendorAdapter, ObjectProvider<PersistenceUnitManager> persistenceUnitManager) {
EntityManagerFactoryBuilder builder = new EntityManagerFactoryBuilder(jpaVendorAdapter, this.properties.getProperties(), persistenceUnitManager.getIfAvailable());
builder.setCallback(getVendorCallback());
return builder;
}
Aggregations