1.本地部署到远程tomcat需修改启动类,在pom中增加依赖
@SpringBootApplication
public class GpsdataApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
// 注意这里要指向原先用main方法执行的Application启动类
return builder.sources(GpsdataApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(GpsdataApplication.class, args);
}
}
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
2.pom可采用阿里云仓库提高下载速度
<repositories>
<repository>
<id>aliyun-repos</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>aliyun-plugin</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
3.spring boot 集成hibernate
利用intelij工具
project structure -> modules -> + hibernate 生成hibernate.cfg.xml
利用persistence 工具 自动配置xml中的内容
application.properties 常用配置
spring.jpa.hibernate.ddl-auto=none
spring.datasource.url=jdbc:mysql:///measure?characterEncoding=utf-8
spring.datasource.username=xxxx
spring.datasource.password=xxxx