What is the springboot embedded and external tomcat startup like
This article is to share with you about springboot embedded and external tomcat startup is how, the editor feels very practical, so share with you to learn, I hope you can learn something after reading this article, say no more, follow the editor to have a look.
one。 Embedded tomcat
1.
Spring-boot-starter-web has built-in tomcat
Org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat 2.0.3.RELEASE compile
The springboot project starts with an embedded tomcat
1)。
@ SpringBootApplication
2)
SpringApplication.run (TelemarketingUsersynApplication.class, args)
two。 Start with an external tomcat
1. Inherit SpringBootServletInitializer
two。 Override the SpringApplicationBuilder method
@ SpringBootApplication (exclude= {DataSourceAutoConfiguration.class}) public class xxxxxx extends SpringBootServletInitializer {@ Override protected SpringApplicationBuilder configure (SpringApplicationBuilder builder) {return builder.sources (xxxxxx. Class);} public static void main (String [] args) {SpringApplication.run (TelemarketingUsersynApplication.class, args);}}
3. Add external tomcat dependencies
Com.jd.security jd-security-tomcat 1.13.WEBAPP org.apache.tomcat tomcat-jasper 8.0.30 provided org.apache.tomcat tomcat-catalina 8.0.30 provided above is what the springboot embedded and external tomcat startup is like. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.