我们开始使用spring boot 2.0.2应用程序,当我们尝试运行main方法时,它会立即关闭。在pom.xml中,当我将父弹簧启动版本更改为2.0.1时,它正常运行。我试图从https://start.spring.io/下载spring boot 2.0.2应用程序,但问题仍然存在。我正在使用java 1.8,也尝试使用java 1.9。是否需要进行任何特定配置才能使2.0.2正常工作?
的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.kalavakuri.springbootpractice</groupId>
<artifactId>springbootpractice</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<packaging>war</packaging>
</project>
ApplicationStarter.java - 这是主类。
package com.kalavakuri.springbootpractice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ApplicationStarter {
public static void main(String[] args) {
SpringApplication.run(ApplicationStarter.class, args);
}
}
以下是日志:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.2.RELEASE)
2018-06-09 13:39:25.705 INFO 14016 --- [ main] c.k.s.ApplicationStarter : Starting ApplicationStarter on DESKTOP-03U51UO with PID 14016 (C:\Personal\oxygen-workspace\springbootpractice\target\classes started by Ramachandrappa K in C:\Personal\oxygen-workspace\springbootpractice)
2018-06-09 13:39:25.705 INFO 14016 --- [ main] c.k.s.ApplicationStarter : No active profile set, falling back to default profiles: default
2018-06-09 13:39:25.799 INFO 14016 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7f77e91b: startup date [Sat Jun 09 13:39:25 IST 2018]; root of context hierarchy
2018-06-09 13:39:27.351 INFO 14016 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-06-09 13:39:27.384 INFO 14016 --- [ main] c.k.s.ApplicationStarter : Started ApplicationStarter in 2.183 seconds (JVM running for 2.893)
2018-06-09 13:39:27.384 INFO 14016 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@7f77e91b: startup date [Sat Jun 09 13:39:25 IST 2018]; root of context hierarchy
2018-06-09 13:39:27.384 INFO 14016 --- [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown