我有一个带有oauth2安全性mySql数据库连接和一些控制器的spring boot应用程序。我已经将其部署在AWS服务器上,它可以正常工作,但是一段时间后它关闭,并且没有收到太多API调用,因此没有理由导致DDOS失败或内存不足错误,我可以在日志中看到以下消息
2018-10-28 10:58:55.979信息1253 --- [Thread-3] ConfigServletWebServerApplicationContext:关闭org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@3ac42916:启动日期[Sun Oct 28 08: 46:01 UTC 2018];上下文层次结构的根 2018-10-28 10:58:55.983信息1253 --- [Thread-3] o.s.c.support.DefaultLifecycleProcessor:在阶段2147483647中停止bean 2018-10-28 10:58:55.985信息1253 --- [Thread-3] o.s.j.e.a.AnnotationMBeanExporter:关闭时注销JMX暴露的bean 2018-10-28 10:58:55.986信息1253 --- [Thread-3] o.s.j.e.a.AnnotationMBeanExporter:注销JMX暴露的bean 2018-10-28 10:58:55.993信息1253 --- [Thread-3] j.LocalContainerEntityManagerFactoryBean:关闭持久性单元'default'的JPA EntityManagerFactory 2018-10-28 10:58:55.994信息1253 --- [Thread-3] com.zaxxer.hikari.HikariDataSource:HikariPool-1-关闭启动... 2018-10-28 10:58:56.002信息1253 --- [Thread-3] com.zaxxer.hikari.HikariDataSource:HikariPool-1-关闭已完成。
这是我的pom.xml
http://maven.apache.org/xsd/maven-4.0.0.xsd“> 4.0.0
<groupId>com.xxx</groupId>
<artifactId>core</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>core</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.flywaydb.flyway-test-extensions</groupId>
<artifactId>flyway-spring-test</artifactId>
<version>5.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
这是我的应用。属性
spring.datasource.url = jdbc:mysql://localhost:3306/xxx?useSSL=false&allowPublicKeyRetrieval=true&autoReconnect=true
spring.datasource.username = xxx
spring.datasource.password = xxx
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.ddl-auto = validate
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jackson.serialization.fail-on-empty-beans=false
logging.level.org.springframework.security=DEBUG
logging.path = logs / core /
答案 0 :(得分:0)
好吧,对于那些可能有类似问题的人,我发现在Linux中使用屏幕模式运行proces可以解决问题