---
title: "spring boot rest artifact迅速构建web应用"
author: "chenss"
date: "2016-11-15T00:36:53Z"
tags: []
categories: ["Web前端"]
slug: "spring-boot-rest-artifact-web"
draft: false
lastmod: "2016-11-15T00:47:01Z"
id: 2337941
url: "https://chenss.iteye.com/blog/2337941"
---

maven里的spring boot rest artifact能让你几分钟内迅速构建基于springMVC, JPA的web应用，大量应用convention over config，默认mvn package就能得到可运行的jar----会启动embedded tomcat在8080端口。

若需要controller，自己往main/java里加即可。

若要加properties，自己建个application.properties放到resources下即可。（database默认为h2内存ddl为create，要换的话在properties里指定连接字符串和dialect即可ddl不用担心）

若要静态html文件（js, html, css, 图片等）自己放到resources/public或resources/static下即可。

若要jsp，放到src/main/webapp里即可。注意通过springboot启动的话jsp就跟静态文件一样不会被编译，打成war包放到tomcat8下则会编译。

若要布到tomcat8下，改pom.xml为war, mvn package出来即是war.

若在eclipse中调试，要把项目改成webapp并把deploy assembly改成src/main/webapp.