aboutsummaryrefslogtreecommitdiff
path: root/juick-notifications/src/main/java/com/juick/components
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-11-11 01:29:01 +0700
committerGravatar Vitaly Takmazov2016-11-11 17:27:58 +0300
commit6604dc96558028c0095f33eca1852de5e61f8466 (patch)
tree5da1118a468d7142250112ee83f81b5849accdf0 /juick-notifications/src/main/java/com/juick/components
parent9077e9f21d785a6507aeb79d04faca2107aa80e4 (diff)
common data configuration is added
Diffstat (limited to 'juick-notifications/src/main/java/com/juick/components')
-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};
}
}