2014-08-18 22:14:17 +08:00
|
|
|
package app
|
|
|
|
|
2016-01-31 17:54:07 +08:00
|
|
|
import java.util.concurrent.Executor
|
|
|
|
|
|
|
|
import org.springframework.context.annotation.Configuration
|
|
|
|
import org.springframework.scheduling.annotation.AsyncConfigurerSupport
|
|
|
|
import org.springframework.scheduling.annotation.EnableAsync
|
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
|
|
|
|
|
2016-04-05 23:50:45 +08:00
|
|
|
import io.spring.initializr.web.project.LegacyStsController
|
2014-08-26 16:45:52 +08:00
|
|
|
|
2016-04-14 22:09:18 +08:00
|
|
|
@Grab('io.spring.initializr:initializr-actuator:1.0.0.BUILD-SNAPSHOT')
|
|
|
|
@Grab('io.spring.initializr:initializr-web:1.0.0.BUILD-SNAPSHOT')
|
2016-04-05 23:50:45 +08:00
|
|
|
@Grab('spring-boot-starter-web')
|
2015-03-24 19:38:00 +08:00
|
|
|
@Grab('spring-boot-starter-redis')
|
2014-08-26 16:45:52 +08:00
|
|
|
class InitializerService {
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
LegacyStsController legacyStsController() {
|
|
|
|
new LegacyStsController()
|
|
|
|
}
|
2016-01-31 17:54:07 +08:00
|
|
|
|
|
|
|
@Configuration
|
|
|
|
@EnableAsync
|
|
|
|
static class AsyncConfiguration extends AsyncConfigurerSupport {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
Executor getAsyncExecutor() {
|
|
|
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor()
|
|
|
|
executor.setCorePoolSize(1)
|
|
|
|
executor.setMaxPoolSize(5)
|
|
|
|
executor.setThreadNamePrefix("initializr-")
|
|
|
|
executor.initialize()
|
|
|
|
executor
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-08-26 16:45:52 +08:00
|
|
|
}
|