• application.properties配置文件


    SpringBoot可以识别两种格式的配置文件,分别是yml文件与properties文件,可以将application.properties文件换成application.yml

    application.properties默认放在:src/main/resource目录下,SpringBoot会自动加载

    比较常用的配置

    server.port=xxxx #端口

    系统属性/变量

    spring.profiles.active=xxx

    该系统变量可以指明要使用的配置文件,一般应用于多环境配置分离

    如:

      spring.profiles.active=dev

      在启动时会加载application-dev.properties配置文件,和application.properties在同一目录下

    mysql基本配置

    引入spring-boot-starter-jdbc

    spring.datasource.url=jdbc:mysql://localhost:3306/dataname?serverTimezone=Asia/Shanghai
    spring.datasource.username=root
    spring.datasource.password=root
    spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

    MyBatis配置

    引入mybatis-spring-boot-starter

    mybatis.config-location=classpath:mybatis/mybatis-config.xml  #放在resources/mybatis/mybatis-config.xml中
    mybatis.mapper-locations= classpath:mybatis/mapper/*.xml
    mybatis.type-aliases-package=com.form.model #类型转换器包,多个逗号隔开

    redis基本配置

    引入spring-boot-starter-data-redis

    spring.redis.host=127.0.0.1
    spring.redis.port=6379
    spring.redis.password=
    spring.redis.timeout=10000

    banner配置

    项目启动时打印的一堆符号

    banner.location=xxx.txt  #可以自定义输出信息的位置
    banner.charset=utf-8  #指定编码格式
    spring.main.banner-mode=console/off    #banner图开启或者打印模式

     字符画生成的网站

    http://www.network-science.de/ascii/
    http://patorjk.com/software/taag/

  • 相关阅读:
    华为交换机端口安全
    华为路由交换命令收集
    Java使用JodaTime处理时间
    Java遍历Map对象的四种方式
    zabbix-2.4.8-1添加MySQL状态监控
    zabbix-2.4.8-1添加tcp状态监控
    zabbix-2.4.8-1添加nginx状态监控
    我的第四个Python小程序
    我的第三个Python小程序
    我的第二个Python小程序
  • 原文地址:https://www.cnblogs.com/baby123/p/10773378.html
Copyright © 2020-2023  润新知