SpringBoot配置文件示例

SpringBoot配置文件示例

一、application.properties
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#                    .::::.                                                                             .::::.        #
#                  .::::::::.                                                                         .::::::::.      #
#                 :::::::::::                                                                        :::::::::::      #
#              ..:::::::::::'                                                                       ':::::::::::..    #
#           '::::::::::::'                                                                           '::::::::::::'   #
#             .::::::::::                                                                            ::::::::::.      #
#        '::::::::::::::..                                                                         ..::::::::::::::`  #
#             ..::::::::::::.                                                                    .::::::::::::..      #
#           ``::::::::::::::::                                                                  ::::::::::::::::``    #
#            ::::``:::::::::'        .:::.                                          .:::.       ':::::::::''::::      #
#           ::::'   ':::::'       .::::::::.                                     .::::::::.       ':::::'   '::::     #
#         .::::'      ::::     .:::::::'::::.                                  .::::':::::::.     ::::      '::::.    #
#        .:::'       :::::  .:::::::::' ':::::.                             .:::::' ':::::::::.  :::::       ':::.    #
#       .::'        :::::.:::::::::'      ':::::.                        .:::::'      ':::::::::.:::::        '::.    #
#      .::'         ::::::::::::::'         ``::::.                   .::::``         `::::::::::::::         '::.    #
#  ...:::           ::::::::::::'              ``::.                .::``              `::::::::::::           :::... #
# ````':.          ':::::::::'                  ::::..         ..::::                  `:::::::::'          .:' ````#
#                    '.:::::'                    ':'````..  ..```':'                     `:::::.'                     #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# ========================== 应用名称 ==========================
spring.application.name=Sb-MulDemo
server.port=8508

# ========================== 编码设置 ==========================
server.servlet.encoding.force=true
server.servlet.encoding.charset=UTF-8
spring.servlet.multipart.max-file-size=1000MB
spring.servlet.multipart.max-request-size=1000MB
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8

# ======================= 数据库基础配置 =======================
spring.datasource.name=druidDataSource
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
# spring.datasource.driver-class-name=com.mysql.jdbc.Driver
# spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver

# ========================== 日志配置 ==========================
# logging.config: classpath:logback-spring.xml
# logging.path: C:\Users\公用\Desktop\logs
# logging.level.com.modules.service=debug


# ======================= Redis基础配置 ========================
spring.redis.database=0
spring.redis.timeout=9000
spring.redis.port=6379

# ====================== Rabbitmq基础配置 ======================
spring.rabbitmq.connection-timeout=9000
spring.rabbitmq.port=5672

# ======================== Mybatis-Plus ========================
mybatis-plus.mapper-locations=classpath:mapper/*/*Mapper.xml
mybatis-plus.type-aliases-package=com.fhiguin.model
# 显示Sql
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
# 使用jdbc的getGeneratedKeys获取数据库自增主键值
mybatis-plus.configuration.use-generated-keys=true
# 使用列标签替换列别名
mybatis-plus.configuration.use-column-label=true
# mybatis传多个参数
mybatis-plus.configuration.use-actual-param-name=true
# 开启驼峰命名转换
mybatis-plus.configuration.map-underscore-to-camel-case=true

# ======================== 指定配置文件 ========================
spring.profiles.active=dev
// 开启分页
@Configuration
public class MybatisPlusConfig {
    /**
     * 分页插件
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }
}
二、application-dev.yml
# =========================== 开发环境 ===========================
server:
  port: 8508

spring:
  # ========================== 应用名称 ==========================
  application:
    name: Sb-MulDemo
  # ========================= 数据库配置 =========================
  datasource:
    url: jdbc:mysql://ip:3306/platform?zeroDateTimeBehavior=convertToNull&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC
    username: 用户名
    password: 密码

#    url: jdbc:oracle:thin:@ip:1521/orcl
#    username: 用户名
#    password: 密码

  # ========================= Redis配置 ==========================
  redis:
    host: ip
    password: 
    database: 12
    port: 6379



# ========================== 个性化参数 ==========================
test: application-dev.yml
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值