aboutsummaryrefslogtreecommitdiff
path: root/juick-notifications/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-notifications/src')
-rw-r--r--juick-notifications/src/main/java/com/juick/components/configuration/NotificationsConfiguration.java13
-rw-r--r--juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java13
2 files changed, 14 insertions, 12 deletions
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);
diff --git a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java
index 1449a4f8..417cc7fa 100644
--- a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java
+++ b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java
@@ -1,4 +1,6 @@
package com.juick.components.configuration;
+
+import com.juick.configuration.DataConfiguration;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
@@ -10,24 +12,23 @@ import javax.servlet.Filter;
public class NotificationsInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
- return new Class[] {NotificationsConfiguration.class};
+ return new Class[]{DataConfiguration.class};
}
@Override
protected Class<?>[] getServletConfigClasses() {
- return null;
+ return new Class[]{NotificationsConfiguration.class};
}
@Override
protected String[] getServletMappings() {
- return new String[] {
- "/"
- };
+ return new String[]{"/"};
}
+
@Override
protected Filter[] getServletFilters() {
CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
characterEncodingFilter.setEncoding("UTF-8");
- return new Filter[] { characterEncodingFilter};
+ return new Filter[]{characterEncodingFilter};
}
}