application.yml

##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   
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值