Spring boot学习(一)创建JavaEE初始化项目

来源:互联网 发布:applem2引擎全套源码 编辑:程序博客网 时间:2024/05/21 17:45

创建初始化项目
这里写图片描述
下一步:选择需要关联的子项目,此时初始化的是一个web项目,因此选择对应的web、devtools、jpa、MySQL等四个插件
这里写图片描述
DevTools:使用这个的目的主要是用于进行热部署
JPA、MySQL:数据库相关的插件库
在引入相关的jar包之后:

在pom.xml文档当中增加一个依赖(对html5文档):

<!--启用不严格检查html--><dependency>    <groupId>net.sourceforge.nekohtml</groupId>    <artifactId>nekohtml</artifactId>    <version>1.9.22</version></dependency><!--spring boot页面模板--><dependency>    <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>

配置application.properties文件

#thymeleaf start#使用非严格类型的HTML5spring.thymeleaf.mode=LEGACYHTML5spring.thymeleaf.encoding=UTF-8spring.thymeleaf.content-type=text/html#开发的时候不开启页面模板缓存处理spring.thymeleaf.cache=false#thymeleaf end#serverserver.port=8080#DB Configuration:spring.datasource.driverClassName = com.mysql.jdbc.Driverspring.datasource.url = jdbc:mysql://localhost:3306/testbootspring.datasource.username = rootspring.datasource.password = root#JPA Configuration:  spring.jpa.database=MySQLspring.jpa.show-sql=true  spring.jpa.generate-ddl=true  spring.jpa.hibernate.ddl-auto=update  #spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect  spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy  #spring.jpa.database=org.hibernate.dialect.MySQL5InnoDBDialect #spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MYSQL5Dialect
0 0
原创粉丝点击