Search in sources :

Example 21 with Bean

use of cn.taketoday.context.annotation.Bean in project today-framework by TAKETODAY.

the class PojoAndStringConfig method employee.

@Bean
public Employee employee() {
    Employee employee = new Employee();
    employee.setName("John Smith");
    employee.setAge(42);
    employee.setCompany("Acme Widgets, Inc.");
    return employee;
}
Also used : Employee(cn.taketoday.beans.testfixture.beans.Employee) Bean(cn.taketoday.context.annotation.Bean)

Example 22 with Bean

use of cn.taketoday.context.annotation.Bean in project today-infrastructure by TAKETODAY.

the class ProxyJCacheConfiguration method cacheInterceptor.

@Bean(name = "jCacheInterceptor")
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public JCacheInterceptor cacheInterceptor(JCacheOperationSource jCacheOperationSource) {
    JCacheInterceptor interceptor = new JCacheInterceptor(this.errorHandler);
    interceptor.setCacheOperationSource(jCacheOperationSource);
    return interceptor;
}
Also used : JCacheInterceptor(cn.taketoday.cache.jcache.interceptor.JCacheInterceptor) Role(cn.taketoday.context.annotation.Role) Bean(cn.taketoday.context.annotation.Bean)

Example 23 with Bean

use of cn.taketoday.context.annotation.Bean in project today-infrastructure by TAKETODAY.

the class ProxyJCacheConfiguration method cacheAdvisor.

@Bean(name = CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryJCacheOperationSourceAdvisor cacheAdvisor(JCacheOperationSource jCacheOperationSource, JCacheInterceptor jCacheInterceptor) {
    BeanFactoryJCacheOperationSourceAdvisor advisor = new BeanFactoryJCacheOperationSourceAdvisor();
    advisor.setCacheOperationSource(jCacheOperationSource);
    advisor.setAdvice(jCacheInterceptor);
    if (this.enableCaching != null) {
        advisor.setOrder(this.enableCaching.<Integer>getNumber("order"));
    }
    return advisor;
}
Also used : BeanFactoryJCacheOperationSourceAdvisor(cn.taketoday.cache.jcache.interceptor.BeanFactoryJCacheOperationSourceAdvisor) Role(cn.taketoday.context.annotation.Role) Bean(cn.taketoday.context.annotation.Bean)

Example 24 with Bean

use of cn.taketoday.context.annotation.Bean in project today-infrastructure by TAKETODAY.

the class TransactionManagerConfiguration method transactionManager2.

@Bean
@NoSynch
public PlatformTransactionManager transactionManager2() {
    CallCountingTransactionManager tm = new CallCountingTransactionManager();
    tm.setTransactionSynchronization(CallCountingTransactionManager.SYNCHRONIZATION_NEVER);
    return tm;
}
Also used : CallCountingTransactionManager(cn.taketoday.transaction.testfixture.CallCountingTransactionManager) Bean(cn.taketoday.context.annotation.Bean)

Example 25 with Bean

use of cn.taketoday.context.annotation.Bean in project today-infrastructure by TAKETODAY.

the class PojoAndStringConfig method employee.

@Bean
public Employee employee() {
    Employee employee = new Employee();
    employee.setName("John Smith");
    employee.setAge(42);
    employee.setCompany("Acme Widgets, Inc.");
    return employee;
}
Also used : Employee(cn.taketoday.beans.testfixture.beans.Employee) Bean(cn.taketoday.context.annotation.Bean)

Aggregations

Bean (cn.taketoday.context.annotation.Bean)25 ConditionalOnMissingBean (cn.taketoday.context.condition.ConditionalOnMissingBean)9 Role (cn.taketoday.context.annotation.Role)8 Employee (cn.taketoday.beans.testfixture.beans.Employee)4 DefaultLifecycleProcessor (cn.taketoday.context.support.DefaultLifecycleProcessor)3 ResourceBundleMessageSource (cn.taketoday.context.support.ResourceBundleMessageSource)3 Duration (java.time.Duration)3 TestBean (cn.taketoday.beans.testfixture.beans.TestBean)2 BeanFactoryCacheOperationSourceAdvisor (cn.taketoday.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor)2 CacheInterceptor (cn.taketoday.cache.interceptor.CacheInterceptor)2 BeanFactoryJCacheOperationSourceAdvisor (cn.taketoday.cache.jcache.interceptor.BeanFactoryJCacheOperationSourceAdvisor)2 JCacheInterceptor (cn.taketoday.cache.jcache.interceptor.JCacheInterceptor)2 BeanAge (cn.taketoday.context.annotation.BeanAge)2 Primary (cn.taketoday.context.annotation.Primary)2 JdbcTemplate (cn.taketoday.jdbc.core.JdbcTemplate)2 NamedParameterJdbcTemplate (cn.taketoday.jdbc.core.namedparam.NamedParameterJdbcTemplate)2 CallCountingTransactionManager (cn.taketoday.transaction.testfixture.CallCountingTransactionManager)2 StringHttpMessageConverter (cn.taketoday.http.converter.StringHttpMessageConverter)1 Charset (java.nio.charset.Charset)1