Fails to start when using @SpringBootApplication with SpringApplicationBuilder.sources
See original GitHub issueuse @SpringBootApplication
with SpringApplicationBuilder
,my app starts failed
// main method
new SpringApplicationBuilder()
.sources(ParentConfig.class)
.child(Child1Config.class)
.sibling(Child2Config.class)
.banner(new AppBanner())
.logStartupInfo(false)
.run(args);
// ParentConfig
@SpringBootApplication
@PropertySource("classpath:/parent.properties")
public class ParentConfig {
}
// Child1Config
@SpringBootApplication
@PropertySource("classpath:/child1.properties")
public class Child1Config {
}
// Child2Config
@SpringBootApplication
@PropertySource("classpath:/child2.properties")
public class Child2Config {
}
the error log as follow:
Description:
The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.
Action:
Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.
2018-02-26 14:30:41.239 INFO 33664 --- [ main] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@109f5dd8: startup date [Mon Feb 26 14:30:39 CST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@a4102b8
2018-02-26 14:30:41.242 INFO 33664 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
the version of springboot is “2.0.0.RC2” or “2.0.0.BUILD-SNAPSHOT”
but if i change the version to “1.5.10.RELEASE”, it work fine.
Another solutation is change the @SpringBootApplication
to @Configuration
in ParentConfig.java
.
I don’t know why, can anyone tell me? Thank you very much!!!
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Spring boot application fails to start - Stack Overflow
I have a Spring Boot Web Application that fails to start with the following error. It's a client application that discovers Eureka server....
Read more >Spring Boot Error ApplicationContextException - Baeldung
The simple solution to fix our error would be to annotate our MainEntryPoint class with the @SpringBootApplication annotation. By using this ...
Read more >SpringApplicationBuilder (Spring Boot 3.0.0 API)
Creates a new SpringApplication instance from the given sources using the given ResourceLoader . SpringApplicationBuilder. environment(ConfigurableEnvironment ...
Read more >Spring Boot - SpringApplicationBuilder Class Example
Testing Spring Boot Application with JUnit and Mockito ... We turn off the banner and the startup information using SpringApplicationBuilder class APIs:.
Read more >java.lang.nosuchmethoderror: org.springframework.boot.builder ...
Now i have created discovery server, using start.spring.io by adding ... Reposted from GitHub: Spring Boot Application fails to start with error "java.lang....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have also faced the same issue, to overcome this issue you can kill the PID using following commands.
It will show as below:
Then run the below command to kill the PID
Now you can re run the Spring application smoothly. Thank you!!
Run the command with the port used : example : lsof -i : 8080(Port number)
Now kill the process. command -: kill -9 <PID> (example : kill -9 8080).