From 6604dc96558028c0095f33eca1852de5e61f8466 Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Fri, 11 Nov 2016 01:29:01 +0700 Subject: common data configuration is added --- .../configuration/NotificationsConfiguration.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'juick-notifications/src/main/java/com/juick/components/configuration/NotificationsConfiguration.java') diff --git a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsConfiguration.java b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsConfiguration.java index 0c7a857c..d42549ef 100644 --- a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsConfiguration.java +++ b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsConfiguration.java @@ -33,22 +33,20 @@ import java.util.concurrent.Executors; */ @Configuration @ComponentScan(basePackages = {"com.juick"}) -@PropertySource(value = "classpath:juick.conf", ignoreResourceNotFound = true) +@PropertySource(value = {"classpath:juick.conf", "file:${user.home}/juick.conf"}) public class NotificationsConfiguration extends WebMvcConfigurationSupport { @Inject Environment env; @Inject - ExecutorService service; + private ServletContext servletContext; @Bean RestTemplate rest() { return new RestTemplate(); } - @Inject - private ServletContext servletContext; @Bean - public Loader templateLoader(){ + public Loader templateLoader() { return new ServletLoader(servletContext); } @@ -73,10 +71,12 @@ public class NotificationsConfiguration extends WebMvcConfigurationSupport { viewResolver.setPebbleEngine(pebbleEngine()); return viewResolver; } + @Bean public Notifications push() { - return new Notifications(env, service); + return new Notifications(env, service()); } + @Bean public ExecutorService service() { return Executors.newCachedThreadPool(); @@ -88,6 +88,7 @@ public class NotificationsConfiguration extends WebMvcConfigurationSupport { mapping.setUseSuffixPatternMatch(false); return mapping; } + @Override protected void addResourceHandlers(ResourceHandlerRegistry registry) { registry.setOrder(0); -- cgit v1.2.3