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
  • Constructor Details

  • 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. From spring.task.scheduling.pool.size property.
      Returns:
      The set up thread pool bean.
    • main

      public static void main​(String[] args)
      Spring Boot entry point.
      Parameters:
      args - Command line arguments.