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

xiaoxiao2021-02-27  541

创建初始化项目 下一步:选择需要关联的子项目,此时初始化的是一个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 #使用非严格类型的HTML5 spring.thymeleaf.mode=LEGACYHTML5 spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.content-type=text/html #开发的时候不开启页面模板缓存处理 spring.thymeleaf.cache=false #thymeleaf end #server server.port=8080 #DB Configuration: spring.datasource.driverClassName = com.mysql.jdbc.Driver spring.datasource.url = jdbc:mysql://localhost:3306/testboot spring.datasource.username = root spring.datasource.password = root #JPA Configuration: spring.jpa.database=MySQL spring.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
转载请注明原文地址: https://www.6miu.com/read-91.html

最新回复(0)