Search in sources :

Example 46 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 47 with Bean

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

the class ActivitiEngineConfiguration method dataSource.

@Bean
public DataSource dataSource() {
    SimpleDriverDataSource ds = new SimpleDriverDataSource();
    try {
        @SuppressWarnings("unchecked") Class<? extends Driver> driverClass = (Class<? extends Driver>) Class.forName(environment.getProperty("jdbc.driver", "org.h2.Driver"));
        ds.setDriverClass(driverClass);
    } catch (Exception e) {
        log.error("Error loading driver class", e);
    }
    // Connection settings
    ds.setUrl(environment.getProperty("jdbc.url", "jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000"));
    ds.setUsername(environment.getProperty("jdbc.username", "sa"));
    ds.setPassword(environment.getProperty("jdbc.password", ""));
    return ds;
}
Also used : Driver(java.sql.Driver) SimpleDriverDataSource(org.springframework.jdbc.datasource.SimpleDriverDataSource) ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 48 with Bean

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

the class Application method seedUsersAndGroups.

@Bean
CommandLineRunner seedUsersAndGroups(final IdentityService identityService) {
    return new CommandLineRunner() {

        @Override
        public void run(String... strings) throws Exception {
            // install groups & users
            Group group = identityService.newGroup("user");
            group.setName("users");
            group.setType("security-role");
            identityService.saveGroup(group);
            User joram = identityService.newUser("jbarrez");
            joram.setFirstName("Joram");
            joram.setLastName("Barrez");
            joram.setPassword("password");
            identityService.saveUser(joram);
            User josh = identityService.newUser("jlong");
            josh.setFirstName("Josh");
            josh.setLastName("Long");
            josh.setPassword("password");
            identityService.saveUser(josh);
            identityService.createMembership("jbarrez", "user");
            identityService.createMembership("jlong", "user");
        }
    };
}
Also used : Group(org.activiti.engine.identity.Group) User(org.activiti.engine.identity.User) CommandLineRunner(org.springframework.boot.CommandLineRunner) Bean(org.springframework.context.annotation.Bean)

Example 49 with Bean

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

the class DispatcherServletConfiguration method requestMappingHandlerMapping.

@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
    log.debug("Creating requestMappingHandlerMapping");
    RequestMappingHandlerMapping requestMappingHandlerMapping = new RequestMappingHandlerMapping();
    requestMappingHandlerMapping.setUseSuffixPatternMatch(false);
    Object[] interceptors = { localeChangeInterceptor() };
    requestMappingHandlerMapping.setInterceptors(interceptors);
    return requestMappingHandlerMapping;
}
Also used : RequestMappingHandlerMapping(org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping) Bean(org.springframework.context.annotation.Bean)

Example 50 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)

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