Package uk.ac.manchester.spinnaker.alloc
Class ServiceConfig
java.lang.Object
javax.ws.rs.core.Application
uk.ac.manchester.spinnaker.alloc.ServiceConfig
@Import({org.apache.cxf.jaxrs.spring.JaxRsConfig.class,MvcConfig.class,SecurityConfig.class}) @PropertySource("classpath:service.properties") @EnableScheduling @EnableAsync @SpringBootApplication @ApplicationPath("spalloc") @Role(0) @EnableConfigurationProperties(SpallocProperties.class) public class ServiceConfig extends Application
Builds the Spring beans in the application that are not auto-detected. There
are no public methods in this class that can be called by non-framework code.
- Author:
- Donal Fellows
- See Also:
SecurityConfig
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ServiceConfig.URLPathMaker
Used for making paths to things in the service in contexts where we can't ask for the current request session to help. -
Constructor Summary
Constructors Constructor Description ServiceConfig()
-
Method Summary
Modifier and Type Method Description JdbcTemplate
historicalDatabase(DataSource ds)
The access to the tombstone database.static void
main(String[] args)
Spring Boot entry point.JdbcTemplate
mainDatabase(DataSource ds)
The access to the main database.PlatformTransactionManager
mainTransactionManager(DataSource ds)
The access to the main database's transaction manager.ThreadPoolTaskScheduler
threadPoolTaskExecutor(int numThreads)
The thread pool.
-
Constructor Details
-
ServiceConfig
public ServiceConfig()
-
-
Method Details
-
mainDatabase
@Bean(name="mainDatabase") @Role(1) public JdbcTemplate mainDatabase(@Qualifier("mainDatasource") DataSource ds)The access to the main database.- Parameters:
ds
- Information from application configuration. (Key:spalloc.datasource
).- Returns:
- Database access API
-
historicalDatabase
@Bean(name="historicalDatabase") @Role(1) public JdbcTemplate historicalDatabase(@Qualifier("historicalDatasource") DataSource ds)The access to the tombstone database.- Parameters:
ds
- Information from application configuration. (Key:spalloc.historical-data.datasource
).- Returns:
- Database access API
-
mainTransactionManager
@Bean(name="mainTransactionManager") @Role(1) public PlatformTransactionManager mainTransactionManager(@Qualifier("mainDatasource") DataSource ds)The access to the main database's transaction manager.- Parameters:
ds
- Information from application configuration. (Key:spalloc.datasource
).- Returns:
- Database transaction API
-
threadPoolTaskExecutor
@Bean(name="threadPoolTaskExecutor") @Primary public ThreadPoolTaskScheduler threadPoolTaskExecutor(@Value("${spring.task.scheduling.pool.size}") int numThreads)The thread pool. The rest of the application expects there to be a single such pool.- Parameters:
numThreads
- The size of the pool. Fromspring.task.scheduling.pool.size
property.- Returns:
- The set up thread pool bean.
-
main
Spring Boot entry point.- Parameters:
args
- Command line arguments.
-