use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean 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.boot.autoconfigure.condition.ConditionalOnMissingBean 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.boot.autoconfigure.condition.ConditionalOnMissingBean 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;
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project spring-boot by spring-projects.
the class ArtemisEmbeddedServerConfiguration method artemisServer.
@Bean(initMethod = "start", destroyMethod = "stop")
@ConditionalOnMissingBean
public EmbeddedJMS artemisServer(org.apache.activemq.artemis.core.config.Configuration configuration, JMSConfiguration jmsConfiguration) {
EmbeddedJMS server = new EmbeddedJMS();
customize(configuration);
server.setConfiguration(configuration);
server.setJmsConfiguration(jmsConfiguration);
server.setRegistry(new ArtemisNoOpBindingRegistry());
return server;
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project spring-boot by spring-projects.
the class EmbeddedLdapAutoConfiguration method ldapContextSource.
@Bean
@DependsOn("directoryServer")
@ConditionalOnMissingBean
public ContextSource ldapContextSource() {
LdapContextSource source = new LdapContextSource();
if (hasCredentials(this.embeddedProperties.getCredential())) {
source.setUserDn(this.embeddedProperties.getCredential().getUsername());
source.setPassword(this.embeddedProperties.getCredential().getPassword());
}
source.setUrls(this.properties.determineUrls(this.environment));
return source;
}
Aggregations