Commit 3b3deea6 authored by xiaoguang.xu's avatar xiaoguang.xu

1. 升级版本号0.2.0 , 2. 修正signal shutdown 非web应用找不到shutdown bean问题.

parent 0ab5b812
......@@ -5,7 +5,7 @@
<parent>
<artifactId>commons-parent</artifactId>
<groupId>cn.quantgroup</groupId>
<version>0.1.6</version>
<version>0.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -36,13 +36,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.6</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>commons-parent</artifactId>
<groupId>cn.quantgroup</groupId>
<version>0.1.6</version>
<version>0.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>commons-parent</artifactId>
<groupId>cn.quantgroup</groupId>
<version>0.1.6</version>
<version>0.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -84,12 +84,6 @@
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.16</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......
......@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cn.quantgroup</groupId>
<artifactId>commons-parent</artifactId>
<version>0.1.6</version>
<version>0.2.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
......@@ -33,11 +33,18 @@
</properties>
<dependencies>
<!--所有工程基础依赖. apollo 配置中心-->
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-client</artifactId>
<version>${apollo.client.version}</version>
</dependency>
<!--所有工程基础依赖. lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.20</version>
</dependency>
</dependencies>
<dependencyManagement>
......@@ -45,22 +52,22 @@
<dependency>
<groupId>cn.quantgroup</groupId>
<artifactId>commons-spring</artifactId>
<version>0.1.6</version>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>cn.quantgroup</groupId>
<artifactId>commons-core</artifactId>
<version>0.1.6</version>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>cn.quantgroup</groupId>
<artifactId>shutdown-spring-boot-starter</artifactId>
<version>0.1.6</version>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>cn.quantgroup</groupId>
<artifactId>brave-spring-boot-starter</artifactId>
<version>0.1.6</version>
<version>0.2.0</version>
</dependency>
</dependencies>
</dependencyManagement>
......
......@@ -5,17 +5,13 @@
<parent>
<artifactId>commons-parent</artifactId>
<groupId>cn.quantgroup</groupId>
<version>0.1.6</version>
<version>0.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>shutdown-spring-boot-starter</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
......@@ -28,6 +24,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<!--以下为可选的-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
......@@ -49,7 +51,6 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
......
......@@ -28,9 +28,11 @@ public class DefaultSignalHandler implements SignalHandler {
log.info("开始执行停止{}服务", applicationName);
GracefulShutdownProperties bean = context.getBean(GracefulShutdownProperties.class);
try {
//如果不是web应用. 这里会找不到shutdown bean
context.getBean(Shutdown.class).shutdown(bean.getTimeout());
log.info("servlet container 停止接收请求");
} catch (InterruptedException e) {
} catch (Exception e) {
log.info("Web 容器 shutdown 失败, 可能没有 Web 容器");
}
log.info("{} 即将执行 @PreDestroy 方法", applicationName);
System.exit(0);
......
......@@ -21,7 +21,6 @@ import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.undertow.UndertowDeploymentInfoCustomizer;
import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainer;
import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment