From bebe7c159f00e6d5a83bb786824d5f32e4de9270 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 24 Feb 2018 16:54:28 +0300 Subject: spring boot wip --- juick-notifications/build.gradle | 9 ++--- .../main/java/com/juick/components/MPNSClient.java | 4 +-- .../main/java/com/juick/components/PushServer.java | 12 +++++++ .../components/configuration/GCMConfiguration.java | 2 +- .../configuration/NotificationsInitializer.java | 39 ---------------------- 5 files changed, 17 insertions(+), 49 deletions(-) create mode 100644 juick-notifications/src/main/java/com/juick/components/PushServer.java delete mode 100644 juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java (limited to 'juick-notifications') diff --git a/juick-notifications/build.gradle b/juick-notifications/build.gradle index 8cf770a6..099e5e29 100644 --- a/juick-notifications/build.gradle +++ b/juick-notifications/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'java' apply plugin: 'war' -apply plugin: 'org.akhikhl.gretty' +apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' dependencies { compile project(':juick-server-web') @@ -14,12 +15,6 @@ dependencies { compileJava.options.encoding = 'UTF-8' -gretty { - httpPort = 8080 - contextPath = '' - servletContainer = 'tomcat8' -} - configurations { all*.exclude module: 'commons-logging' } diff --git a/juick-notifications/src/main/java/com/juick/components/MPNSClient.java b/juick-notifications/src/main/java/com/juick/components/MPNSClient.java index 21286258..efa47bb1 100644 --- a/juick-notifications/src/main/java/com/juick/components/MPNSClient.java +++ b/juick-notifications/src/main/java/com/juick/components/MPNSClient.java @@ -34,9 +34,9 @@ public class MPNSClient { @Inject private ObjectMapper jsonMapper; - @Value("${wns_application_sip}") + @Value("${wns_application_sip:}") private String applicationSip; - @Value("${wns_client_secret}") + @Value("${wns_client_secret:}") private String applicationSecret; private RestTemplate wnsService; diff --git a/juick-notifications/src/main/java/com/juick/components/PushServer.java b/juick-notifications/src/main/java/com/juick/components/PushServer.java new file mode 100644 index 00000000..c22f48dc --- /dev/null +++ b/juick-notifications/src/main/java/com/juick/components/PushServer.java @@ -0,0 +1,12 @@ +package com.juick.components; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class PushServer { + + public static void main(String[] args) { + SpringApplication.run(PushServer.class, args); + } +} diff --git a/juick-notifications/src/main/java/com/juick/components/configuration/GCMConfiguration.java b/juick-notifications/src/main/java/com/juick/components/configuration/GCMConfiguration.java index 96c7716f..27e1af0f 100644 --- a/juick-notifications/src/main/java/com/juick/components/configuration/GCMConfiguration.java +++ b/juick-notifications/src/main/java/com/juick/components/configuration/GCMConfiguration.java @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration; */ @Configuration public class GCMConfiguration { - @Value("${gcm_key}") + @Value("${gcm_key:}") private String gcmKey; @Bean 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 deleted file mode 100644 index d4068d26..00000000 --- a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.juick.components.configuration; - -import org.apache.commons.codec.CharEncoding; -import org.springframework.web.filter.CharacterEncodingFilter; -import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; - -import javax.servlet.Filter; - -/** - * Created by vt on 09/02/16. - */ -public class NotificationsInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { - - @Override - protected Class[] getRootConfigClasses() { - return new Class[] {}; - } - - @Override - protected Class[] getServletConfigClasses() { - return new Class[]{ NotificationsAppConfiguration.class }; - } - - @Override - protected String[] getServletMappings() { - return new String[]{"/"}; - } - - @Override - protected Filter[] getServletFilters() { - CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter(CharEncoding.UTF_8); - return new Filter[]{characterEncodingFilter}; - } - - @Override - protected String getServletName() { - return "Notifications dispatcher servlet"; - } -} -- cgit v1.2.3