I was studying JavaBrain's spring boot video and I ran into the same error as the link below.
Why does my Spring Boot App always shutdown immediately after starting?
I have specified the dependency of spring-boot-starter-web, but still got the error. My pom.xml looks like this. The thing is when I change the version of spring-boot-starter-parent to 1.4.2.RELEASE everything works fine(I can access the localhost:8080). I wonder why this is happening and what can I do to make version 2.0.1.RELEASE to work.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
The code looks like this:
@SpringBootApplication
public class CourseApiApp {
public static void main(String[] args) {
SpringApplication.run(CourseApiApp.class, args);
}
}
The output:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.1.RELEASE)
2018-04-16 21:42:07.576 INFO 8976 --- [ main] org.kouchibin.web.CourseApiApp : Starting CourseApiApp on SAI with PID 8976 (C:\Users\86660\Documents\workspace-sts\course-api\target\classes started by kcb in C:\Users\86660\Documents\workspace-sts\course-api)
2018-04-16 21:42:07.583 INFO 8976 --- [ main] org.kouchibin.web.CourseApiApp : No active profile set, falling back to default profiles: default
2018-04-16 21:42:07.670 INFO 8976 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@4c40b76e: startup date [Mon Apr 16 21:42:07 CST 2018]; root of context hierarchy
2018-04-16 21:42:08.971 INFO 8976 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-04-16 21:42:08.990 INFO 8976 --- [ main] org.kouchibin.web.CourseApiApp : Started CourseApiApp in 1.976 seconds (JVM running for 2.624)
2018-04-16 21:42:08.997 INFO 8976 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@4c40b76e: startup date [Mon Apr 16 21:42:07 CST 2018]; root of context hierarchy
2018-04-16 21:42:09.000 INFO 8976 --- [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown