Search in sources :

Example 21 with ConditionalOnMissingBean

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;
}
Also used : MethodValidationPostProcessor(org.springframework.validation.beanvalidation.MethodValidationPostProcessor) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean) LocalValidatorFactoryBean(org.springframework.validation.beanvalidation.LocalValidatorFactoryBean)

Example 22 with ConditionalOnMissingBean

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();
}
Also used : Storage(de.flapdoodle.embed.mongo.config.Storage) Net(de.flapdoodle.embed.mongo.config.Net) MongodConfigBuilder(de.flapdoodle.embed.mongo.config.MongodConfigBuilder) IFeatureAwareVersion(de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ReactiveMongoClientFactoryBean(org.springframework.data.mongodb.core.ReactiveMongoClientFactoryBean) MongoClientFactoryBean(org.springframework.data.mongodb.core.MongoClientFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 23 with ConditionalOnMissingBean

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;
}
Also used : EntityManagerFactoryBuilder(org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 24 with ConditionalOnMissingBean

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;
}
Also used : EmbeddedJMS(org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 25 with ConditionalOnMissingBean

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;
}
Also used : LdapContextSource(org.springframework.ldap.core.support.LdapContextSource) DependsOn(org.springframework.context.annotation.DependsOn) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)807 Bean (org.springframework.context.annotation.Bean)807 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)339 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)298 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)251 Lazy (org.springframework.context.annotation.Lazy)227 lombok.val (lombok.val)210 HashMap (java.util.HashMap)190 Map (java.util.Map)113 CamelContextAware (org.apache.camel.CamelContextAware)69 RuntimeCamelException (org.apache.camel.RuntimeCamelException)45 DataFormatFactory (org.apache.camel.spi.DataFormatFactory)45 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)29 Scope (org.springframework.context.annotation.Scope)26 Autowired (org.springframework.beans.factory.annotation.Autowired)23 Configuration (org.springframework.context.annotation.Configuration)21 Qualifier (org.springframework.beans.factory.annotation.Qualifier)20 DefaultChainingMultifactorAuthenticationBypassProvider (org.apereo.cas.authentication.bypass.DefaultChainingMultifactorAuthenticationBypassProvider)19 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)19 AuthenticationMultifactorAuthenticationProviderBypassEvaluator (org.apereo.cas.authentication.bypass.AuthenticationMultifactorAuthenticationProviderBypassEvaluator)17