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