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;
}
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);
}
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);
}
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();
}
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);
}
Aggregations