常用application.yml配置

====================================================server配置========================================================
#1.配置tomcat访问端口
server:
  port: 7778
#2.配置http://localhost:7778/aa/bb.html这个访问地址的意思
  servlet:
    context-path: /aa
#3.Session设置存活时间是30分钟
  session-timeout: 30
#4.omcat起动的最大线程数,即同时处理的任务个数,默认值为200
  tomcat.max-threads: 0
#5.Tomcat在解析参数的时候没有使用正确的编码格式(UTF-8)去解码
  tomcat.uri-encoding: UTF-8
====================================================spring配置========================================================
spring:
  application:
#1.服务名称信息
      name: mimi
#2.配置启动banner的编码和文字
  banner:
    charset: UTF-8
    location: classpath:banner.txt
#3.spring:datasource下的)配置数据库
  datasource:
    #1.配置数据库连接池(Druid,),HikariCP 是默认的
    type: com.alibaba.druid.pool.DruidDataSource
    #2.数据库的地址
    url: jdbc:mysql://localhost:3306/a1a1?characterEncoding=UTF-8&serverTimezone=GMT%2B8
    #3.配置数据库驱动,jdbc
    driver-class-name: com.mysql.cj.jdbc.Driver
    #4.配置数据库连接的账号
    username: root
    #5.配置数据库连接的密码
    password: 123456
#4.(spring:mvc下的)关于springmvc的设置
  mvc:
    #1.静态资源的过滤规则(在静态资源目录下,只有以/resources/开头的才能显示,不然不能显示)
       static-path-pattern: /resources/**
#5.(spring:resources下的)设置静态资源的路径(默认的是classpath:/static,classpath:/public,classpath:/resources,classpath:/META-INF/resource)
  resources:
      static-locations: ["classpath:/static/", "classpath:/public/","classpath:/mapper/"]
#6.thymeleaf的模板配置
  thymeleaf:
      prefix: classpath:/templates
      mode: HTML
      cache: false
      encoding: UTF-8
      #     新版本不支持content-type: text/html,故新写法
      servlet:
        content-type: text/html

         

====================================================mybatis配置========================================================

  

# mybatis的配置
mybatis:
#1.配置mapper文件放在resource下的mapper中
    mapper-locations: classpath:/mapper/*.xml
#2.配置实体扫描,多个package用逗号或者分号分隔
    type-aliases-package: com.example.demo.entity
#3.配置mybatis日志打印(这个生效后下面logging中的打印失效)
    configuration:
      log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#4.配置mybatis配置文件
      location: classpath:mybatis/mybatis-config.xml
 #打印等级(com.example.demo.dao包下的日志会打印),不是mybatis子配置
logging:
    level:
      com.example.demo.dao:  debug

  • 5
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值