Search in sources :

Example 61 with Bean

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

the class BatchAutoConfiguration method jobOperator.

@Bean
@ConditionalOnMissingBean(JobOperator.class)
public SimpleJobOperator jobOperator(JobExplorer jobExplorer, JobLauncher jobLauncher, ListableJobLocator jobRegistry, JobRepository jobRepository) throws Exception {
    SimpleJobOperator factory = new SimpleJobOperator();
    factory.setJobExplorer(jobExplorer);
    factory.setJobLauncher(jobLauncher);
    factory.setJobRegistry(jobRegistry);
    factory.setJobRepository(jobRepository);
    if (this.jobParametersConverter != null) {
        factory.setJobParametersConverter(this.jobParametersConverter);
    }
    return factory;
}
Also used : SimpleJobOperator(org.springframework.batch.core.launch.support.SimpleJobOperator) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) JobExplorerFactoryBean(org.springframework.batch.core.explore.support.JobExplorerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 62 with Bean

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

the class RedisCacheConfiguration method cacheManager.

@Bean
public RedisCacheManager cacheManager(RedisTemplate<Object, Object> redisTemplate) {
    RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate);
    cacheManager.setUsePrefix(true);
    List<String> cacheNames = this.cacheProperties.getCacheNames();
    if (!cacheNames.isEmpty()) {
        cacheManager.setCacheNames(cacheNames);
    }
    return this.customizerInvoker.customize(cacheManager);
}
Also used : RedisCacheManager(org.springframework.data.redis.cache.RedisCacheManager) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 63 with Bean

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

the class SimpleCacheConfiguration method cacheManager.

@Bean
public ConcurrentMapCacheManager cacheManager() {
    ConcurrentMapCacheManager cacheManager = new ConcurrentMapCacheManager();
    List<String> cacheNames = this.cacheProperties.getCacheNames();
    if (!cacheNames.isEmpty()) {
        cacheManager.setCacheNames(cacheNames);
    }
    return this.customizerInvoker.customize(cacheManager);
}
Also used : ConcurrentMapCacheManager(org.springframework.cache.concurrent.ConcurrentMapCacheManager) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 64 with Bean

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

the class CassandraAutoConfiguration method cluster.

@Bean
@ConditionalOnMissingBean
public Cluster cluster() {
    CassandraProperties properties = this.properties;
    Cluster.Builder builder = Cluster.builder().withClusterName(properties.getClusterName()).withPort(properties.getPort());
    if (properties.getUsername() != null) {
        builder.withCredentials(properties.getUsername(), properties.getPassword());
    }
    if (properties.getCompression() != null) {
        builder.withCompression(properties.getCompression());
    }
    if (properties.getLoadBalancingPolicy() != null) {
        LoadBalancingPolicy policy = instantiate(properties.getLoadBalancingPolicy());
        builder.withLoadBalancingPolicy(policy);
    }
    builder.withQueryOptions(getQueryOptions());
    if (properties.getReconnectionPolicy() != null) {
        ReconnectionPolicy policy = instantiate(properties.getReconnectionPolicy());
        builder.withReconnectionPolicy(policy);
    }
    if (properties.getRetryPolicy() != null) {
        RetryPolicy policy = instantiate(properties.getRetryPolicy());
        builder.withRetryPolicy(policy);
    }
    builder.withSocketOptions(getSocketOptions());
    if (properties.isSsl()) {
        builder.withSSL();
    }
    String points = properties.getContactPoints();
    builder.addContactPoints(StringUtils.commaDelimitedListToStringArray(points));
    customize(builder);
    return builder.build();
}
Also used : LoadBalancingPolicy(com.datastax.driver.core.policies.LoadBalancingPolicy) ReconnectionPolicy(com.datastax.driver.core.policies.ReconnectionPolicy) Cluster(com.datastax.driver.core.Cluster) RetryPolicy(com.datastax.driver.core.policies.RetryPolicy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 65 with Bean

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

the class CouchbaseCacheConfiguration method cacheManager.

@Bean
public CouchbaseCacheManager cacheManager() {
    List<String> cacheNames = this.cacheProperties.getCacheNames();
    CouchbaseCacheManager cacheManager = new CouchbaseCacheManager(CacheBuilder.newInstance(this.bucket).withExpiration(this.cacheProperties.getCouchbase().getExpirationSeconds()), cacheNames.toArray(new String[cacheNames.size()]));
    return this.customizers.customize(cacheManager);
}
Also used : CouchbaseCacheManager(com.couchbase.client.spring.cache.CouchbaseCacheManager) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) 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