Search in sources :

Example 36 with Bean

use of org.springframework.context.annotation.Bean in project rhino by PLOS.

the class RhinoConfiguration method sessionFactory.

@Bean
public AnnotationSessionFactoryBean sessionFactory(DataSource hibernateDataSource) throws IOException {
    // May be switched to true in a dev environment to log SQL code generated by Hibernate.
    // Could be replaced with environmental config if needed.
    final boolean hibernateIsInDebugMode = false;
    AnnotationSessionFactoryBean bean = new AnnotationSessionFactoryBean();
    bean.setDataSource(hibernateDataSource);
    Properties hibernateProperties = new Properties();
    hibernateProperties.setProperty("hibernate.dialect", org.hibernate.dialect.MySQLDialect.class.getName());
    hibernateProperties.setProperty("hibernate.show_sql", Boolean.toString(hibernateIsInDebugMode));
    hibernateProperties.setProperty("hibernate.format_sql", Boolean.toString(hibernateIsInDebugMode));
    bean.setHibernateProperties(hibernateProperties);
    bean.setPackagesToScan("org.ambraproject.rhino.model");
    return bean;
}
Also used : AnnotationSessionFactoryBean(org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean) Properties(java.util.Properties) AnnotationSessionFactoryBean(org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 37 with Bean

use of org.springframework.context.annotation.Bean in project Activiti by Activiti.

the class JPAActivitiEngineConfiguration method processEngineConfiguration.

@Bean(name = "processEngineConfiguration")
public ProcessEngineConfigurationImpl processEngineConfiguration() {
    SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
    processEngineConfiguration.setDataSource(dataSource);
    processEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
    processEngineConfiguration.setTransactionManager(transactionManager);
    processEngineConfiguration.setJobExecutorActivate(false);
    processEngineConfiguration.setAsyncExecutorEnabled(true);
    processEngineConfiguration.setAsyncExecutorActivate(false);
    processEngineConfiguration.setJpaEntityManagerFactory(entityManagerFactory);
    processEngineConfiguration.setJpaHandleTransaction(false);
    processEngineConfiguration.setJpaHandleTransaction(false);
    processEngineConfiguration.setHistoryLevel(HistoryLevel.FULL);
    return processEngineConfiguration;
}
Also used : SpringProcessEngineConfiguration(org.activiti.spring.SpringProcessEngineConfiguration) ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 38 with Bean

use of org.springframework.context.annotation.Bean in project Activiti by Activiti.

the class JPAActivitiEngineConfiguration method processEngineFactoryBean.

@Bean(name = "processEngineFactoryBean")
public ProcessEngineFactoryBean processEngineFactoryBean() {
    ProcessEngineFactoryBean factoryBean = new ProcessEngineFactoryBean();
    factoryBean.setProcessEngineConfiguration(processEngineConfiguration());
    return factoryBean;
}
Also used : ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 39 with Bean

use of org.springframework.context.annotation.Bean in project Activiti by Activiti.

the class ActivitiEngineConfiguration method annotationDrivenTransactionManager.

@Bean(name = "transactionManager")
public PlatformTransactionManager annotationDrivenTransactionManager() {
    DataSourceTransactionManager transactionManager = new DataSourceTransactionManager();
    transactionManager.setDataSource(dataSource());
    return transactionManager;
}
Also used : DataSourceTransactionManager(org.springframework.jdbc.datasource.DataSourceTransactionManager) ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 40 with Bean

use of org.springframework.context.annotation.Bean in project Activiti by Activiti.

the class ActivitiEngineConfiguration method processEngineFactoryBean.

@Bean(name = "processEngineFactoryBean")
public ProcessEngineFactoryBean processEngineFactoryBean() {
    ProcessEngineFactoryBean factoryBean = new ProcessEngineFactoryBean();
    factoryBean.setProcessEngineConfiguration(processEngineConfiguration());
    return factoryBean;
}
Also used : ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Bean (org.springframework.context.annotation.Bean)3865 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1065 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)444 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)389 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)190 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)151 Map (java.util.Map)150 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)110 Properties (java.util.Properties)94 Autowired (org.springframework.beans.factory.annotation.Autowired)92 ArrayList (java.util.ArrayList)79 Primary (org.springframework.context.annotation.Primary)75 Qualifier (org.springframework.beans.factory.annotation.Qualifier)71 CamelContextAware (org.apache.camel.CamelContextAware)69 ThreadPoolTaskExecutor (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor)68 JpaTransactionManager (org.springframework.orm.jpa.JpaTransactionManager)59