Package uk.ac.manchester.spinnaker.alloc
Class ServiceConfig
java.lang.Object
jakarta.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 jakarta.ws.rs.core.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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
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 -
Method Summary
Modifier and TypeMethodDescriptionThe access to the tombstone database.static void
Spring Boot entry point.The access to the main database.The access to the main database's transaction manager.threadPoolTaskExecutor
(int numThreads) The thread pool.Methods inherited from class jakarta.ws.rs.core.Application
getClasses, getProperties, getSingletons
-
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.
-