use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class GenericCacheConfiguration method cacheManager.
@Bean
public SimpleCacheManager cacheManager(Collection<Cache> caches) {
SimpleCacheManager cacheManager = new SimpleCacheManager();
cacheManager.setCaches(caches);
return this.customizers.customize(cacheManager);
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class InfinispanCacheConfiguration method infinispanCacheManager.
@Bean(destroyMethod = "stop")
@ConditionalOnMissingBean
public EmbeddedCacheManager infinispanCacheManager() throws IOException {
EmbeddedCacheManager cacheManager = createEmbeddedCacheManager();
List<String> cacheNames = this.cacheProperties.getCacheNames();
if (!CollectionUtils.isEmpty(cacheNames)) {
for (String cacheName : cacheNames) {
cacheManager.defineConfiguration(cacheName, getDefaultCacheConfiguration());
}
}
return cacheManager;
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class PersistenceExceptionTranslationAutoConfiguration method persistenceExceptionTranslationPostProcessor.
@Bean
@ConditionalOnMissingBean(PersistenceExceptionTranslationPostProcessor.class)
@ConditionalOnProperty(prefix = "spring.dao.exceptiontranslation", name = "enabled", matchIfMissing = true)
public static PersistenceExceptionTranslationPostProcessor persistenceExceptionTranslationPostProcessor() {
PersistenceExceptionTranslationPostProcessor postProcessor = new PersistenceExceptionTranslationPostProcessor();
postProcessor.setProxyTargetClass(true);
return postProcessor;
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class MongoDataAutoConfiguration method mongoMappingContext.
@Bean
@ConditionalOnMissingBean
public MongoMappingContext mongoMappingContext(BeanFactory beanFactory, CustomConversions conversions) throws ClassNotFoundException {
MongoMappingContext context = new MongoMappingContext();
context.setInitialEntitySet(new EntityScanner(this.applicationContext).scan(Document.class, Persistent.class));
Class<?> strategyClass = this.properties.getFieldNamingStrategy();
if (strategyClass != null) {
context.setFieldNamingStrategy((FieldNamingStrategy) BeanUtils.instantiateClass(strategyClass));
}
context.setSimpleTypeHolder(conversions.getSimpleTypeHolder());
return context;
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class Neo4jDataAutoConfiguration method sessionFactory.
@Bean
public SessionFactory sessionFactory(org.neo4j.ogm.config.Configuration configuration, ApplicationContext applicationContext, ObjectProvider<List<EventListener>> eventListeners) {
SessionFactory sessionFactory = new SessionFactory(configuration, getPackagesToScan(applicationContext));
List<EventListener> providedEventListeners = eventListeners.getIfAvailable();
if (providedEventListeners != null) {
for (EventListener eventListener : providedEventListeners) {
sessionFactory.register(eventListener);
}
}
return sessionFactory;
}
Aggregations