Search in sources :

Example 86 with Bean

use of org.springframework.context.annotation.Bean 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 87 with Bean

use of org.springframework.context.annotation.Bean 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)

Example 88 with Bean

use of org.springframework.context.annotation.Bean in project spring-framework by spring-projects.

the class ProxyJCacheConfiguration method cacheInterceptor.

@Bean(name = "jCacheInterceptor")
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public JCacheInterceptor cacheInterceptor() {
    JCacheInterceptor interceptor = new JCacheInterceptor();
    interceptor.setCacheOperationSource(cacheOperationSource());
    if (this.errorHandler != null) {
        interceptor.setErrorHandler(this.errorHandler);
    }
    return interceptor;
}
Also used : JCacheInterceptor(org.springframework.cache.jcache.interceptor.JCacheInterceptor) Role(org.springframework.context.annotation.Role) Bean(org.springframework.context.annotation.Bean)

Example 89 with Bean

use of org.springframework.context.annotation.Bean in project spring-framework by spring-projects.

the class ProxyCachingConfiguration method cacheAdvisor.

@Bean(name = CacheManagementConfigUtils.CACHE_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryCacheOperationSourceAdvisor cacheAdvisor() {
    BeanFactoryCacheOperationSourceAdvisor advisor = new BeanFactoryCacheOperationSourceAdvisor();
    advisor.setCacheOperationSource(cacheOperationSource());
    advisor.setAdvice(cacheInterceptor());
    advisor.setOrder(this.enableCaching.<Integer>getNumber("order"));
    return advisor;
}
Also used : BeanFactoryCacheOperationSourceAdvisor(org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor) Role(org.springframework.context.annotation.Role) Bean(org.springframework.context.annotation.Bean)

Example 90 with Bean

use of org.springframework.context.annotation.Bean in project spring-framework by spring-projects.

the class AbstractMessageBrokerConfiguration method brokerChannelExecutor.

@Bean
public ThreadPoolTaskExecutor brokerChannelExecutor() {
    ChannelRegistration reg = getBrokerRegistry().getBrokerChannelRegistration();
    ThreadPoolTaskExecutor executor;
    if (reg.hasTaskExecutor()) {
        executor = reg.taskExecutor().getTaskExecutor();
    } else {
        // Should never be used
        executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(0);
        executor.setMaxPoolSize(1);
        executor.setQueueCapacity(0);
    }
    executor.setThreadNamePrefix("brokerChannel-");
    return executor;
}
Also used : ThreadPoolTaskExecutor(org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor) Bean(org.springframework.context.annotation.Bean)

Aggregations

Bean (org.springframework.context.annotation.Bean)4059 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1090 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)444 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)393 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)309 lombok.val (lombok.val)294 HashMap (java.util.HashMap)285 Lazy (org.springframework.context.annotation.Lazy)257 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)194 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)158 Map (java.util.Map)152 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)112 Properties (java.util.Properties)100 Autowired (org.springframework.beans.factory.annotation.Autowired)93 ArrayList (java.util.ArrayList)85 Primary (org.springframework.context.annotation.Primary)84 Qualifier (org.springframework.beans.factory.annotation.Qualifier)75 CamelContextAware (org.apache.camel.CamelContextAware)69 ThreadPoolTaskExecutor (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor)69 JpaTransactionManager (org.springframework.orm.jpa.JpaTransactionManager)61