springboot application.yml profile.
server:
port: 8080
servlet:
context-path: /
spring:
application:
name: springboot
jpa:
show-sql: true
hibernate:
ddl-auto: update
properties:
hibernate.format_sql: true
open-in-view: false
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
datasource:
url: jdbc:mysql://127.0.0.1:3306/test1?autoReconnect=true
username: root
password: xxxxx
tomcat:
max-active: 4
min-idle: 2
initial-size: 2
hikari:
maximum-pool-size: 20
minimum-idle: 5
thymeleaf:
mode: HTML
encoding: UTF-8
servlet:
content-type: text/html
cache: false
mvc:
view:
prefix: classpath:/templates/
static-path-pattern: /**
resources:
static-locations: classpath:/static/
static-path-pattern: / ** . And static-locations: classpath: / static / future can be written in without entering static page views inside the static files. But directly address write access. Of course, you can customize
@Configuration @EnableWebMvc public class WebConfig extends WebMvcConfigurerAdapter { }
There is also a look at the most important pom.xml
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.6.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding > UTF-. 8 </ project.reporting.outputEncoding > < the java.version > 1.8 </ the java.version > </ Properties > < Dependencies > <-! upper incorporated parent, and therefore need not be specified below version - -> <! - comprising mvc, aop jar and other resources -> < dependency > < the groupId > org.springframework.boot </ the groupId > < the artifactId > Spring-Boot-Starter-Web </ the artifactId > </dependency > < dependency > < the groupId > org.springframework.boot </ the groupId > < the artifactId > Spring-Boot-Starter-Test </ the artifactId > < scope > Test </ scope > </ dependency > <-! Spring operation of the database jpa data into a set of classes and methods database -> < dependency > < the groupId > org.springframework.boot </ the groupId > <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <!-- 热部署 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <scope>true</scope> </dependency> <!- ->the Spring template engine <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <!--数据库相关--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20180813</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>