##yml文件和properties文件都可以,这个更简便
server:
tomcat:
uri-encoding: UTF-8
port: 8080
context-path: /spring-boot
session:
timeout: 10 #话过期时间,单位s
hello: 这个可以传值到controller
##也可以这样配置类似json,可以和hello一样在controller中取值
context: "hello: ${hello},nihao:nihao"
##在类上写注解就可以将这些值set到该类上,然后在controller注入该bean即可获取值
student:
name: fc
age: 27
##配置这个,否则html访问不了
spring:
thymeleaf:
mode: LEGACYHTML5
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/springboot
username: root
password: ""
jpa:
hibernate:
ddl-auto: none ##create运行时根据entity类上注解自动创建表
show-sql: true #控制台打印sql语句
http:
encoding: ##解
charset: UTF-8 ###决 404.html乱码,其它html不需要设置这个也不会乱码
force: true ######乱
enabled: true ####码
mvc:
favicon:
enabled: false
#日志
logging:
file: D:/mylog/log.log
server:
tomcat:
uri-encoding: UTF-8
port: 8080
context-path: /spring-boot
session:
timeout: 10 #话过期时间,单位s
hello: 这个可以传值到controller
##也可以这样配置类似json,可以和hello一样在controller中取值
context: "hello: ${hello},nihao:nihao"
##在类上写注解就可以将这些值set到该类上,然后在controller注入该bean即可获取值
student:
name: fc
age: 27
##配置这个,否则html访问不了
spring:
thymeleaf:
mode: LEGACYHTML5
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/springboot
username: root
password: ""
jpa:
hibernate:
ddl-auto: none ##create运行时根据entity类上注解自动创建表
show-sql: true #控制台打印sql语句
http:
encoding: ##解
charset: UTF-8 ###决 404.html乱码,其它html不需要设置这个也不会乱码
force: true ######乱
enabled: true ####码
mvc:
favicon:
enabled: false
#日志
logging:
file: D:/mylog/log.log