SpringBootTomcat启动实例代码详解
废话不多了,具体内容如下所示:
在洪泽等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站设计、做网站 网站设计制作按需求定制网站,公司网站建设,企业网站建设,成都品牌网站建设,全网营销推广,成都外贸网站建设,洪泽网站建设费用合理。
Application configuration class:
@SpringBootApplication
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ServletInitializer.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(ServletInitializer.class, args);
}
}注意: 启动类放在项目的包的最外层最好,这样可以扫描到所有的包路径。
controller:
@Controller
public class BootController {
@RequestMapping("/")
@ResponseBody
String home() {
return "Hello World!";
}
public static void main(String[] args) throws Exception {
SpringApplication.run(BootController.class, args);
}
}pom
4.0.0 cn.creditease.springboot springboot war 1.0 Maven Webapp http://maven.apache.org UTF-8 UTF-8 1.7 1.7 7.0.67 org.springframework.boot spring-boot-starter-parent 1.4.1.RELEASE org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat provided org.springframework.boot spring-boot-starter-test test spring-releases Spring Releases http://repo.spring.io/libs-release-local true
注意:如果想用tomcat7启动要制定你的tomcat版本号。
server: port: 8080 spring.mvc.view.prefix: /WEB-INF/jsp/ spring.mvc.view.suffix: .jsp
项目

总结
以上所述是小编给大家介绍的SpringBoot Tomcat启动实例代码详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对创新互联网站的支持!
当前名称:SpringBootTomcat启动实例代码详解
链接分享:http://www.jxjierui.cn/article/jggcjg.html


咨询
建站咨询
