美文网首页
记录一下 intellij 易忘却重要的操作

记录一下 intellij 易忘却重要的操作

作者: bd6b5cde5ce9 | 来源:发表于2020-04-02 15:29 被阅读0次

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

相关文章

网友评论

      本文标题:记录一下 intellij 易忘却重要的操作

      本文链接:https://www.haomeiwen.com/subject/szuxphtx.html