From 06e420b3905ed27aea311c4811a84aba5106d325 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 2 Mar 2020 11:03:57 +0300 Subject: Simplify configuration --- .../server/configuration/BaseWebConfiguration.java | 30 ++++------------------ 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java b/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java index a05b4fc1..2e3ec33d 100644 --- a/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java +++ b/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java @@ -24,51 +24,31 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.Resource; -import org.springframework.scheduling.annotation.SchedulingConfigurer; -import org.springframework.scheduling.config.ScheduledTaskRegistrar; -import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter; -import javax.annotation.Nonnull; import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; /** * Created by vitalyster on 28.06.2016. */ @Configuration -public class BaseWebConfiguration implements WebMvcConfigurer, SchedulingConfigurer { +public class BaseWebConfiguration implements WebMvcConfigurer { @Value("${keystore:classpath:juick-test-key.p12}") private Resource keystore; @Value("${keystore_password:secret}") private String keystorePassword; - @Override - public void configurePathMatch(PathMatchConfigurer configurer) { - configurer.setUseSuffixPatternMatch(false); - } - @Bean public ResourceUrlEncodingFilter resourceUrlEncodingFilter() { return new ResourceUrlEncodingFilter(); } - @Override - public void configureTasks(@Nonnull ScheduledTaskRegistrar taskRegistrar) { - taskRegistrar.setScheduler(taskExecutor()); - } - - @Bean(destroyMethod="shutdown") - public Executor taskExecutor() { - return Executors.newScheduledThreadPool(100); - } - - @Bean - public ExecutorService executorService() { - return Executors.newCachedThreadPool(); + @Bean(name = "threadPoolTaskExecutor") + public Executor threadPoolTaskExecutor() { + return new ThreadPoolTaskExecutor(); } @Bean public KeystoreManager keystoreManager() { -- cgit v1.2.3