1. 程式人生 > >springboot多個配置檔案的配置 多個application.properties的配置 版本 sprigboot2.1

springboot多個配置檔案的配置 多個application.properties的配置 版本 sprigboot2.1

注意副配置檔案的命名方式是application-XXX.properties

spring.profiles.active=druid   

spring.profiles.active=druid


server.address=127.0.0.1

server.port=8081

#必須有
mybatis.mapper-locations=classpath*:com/hanhan/dao/xmlMapper/*.xml
#必須有
logging.config=classpath:logback.xml
#必須有
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#必須有
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/ipace?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT
#必須有
spring.datasource.username=root
#必須用
spring.datasource.password=root


#32位隨機字串
#dd9008e5ec8608c9eb9d57ab764651eb
rand.str = ${random.value}
#36位,比32位的多了4個-
#0cf88531-9569-44c4-926e-2528dd5948e2
rand.uuid = ${random.uuid}
#隨機int型別,主意有負數
rand.intid = ${random.int}
#隨機long型別
rand.longid = ${random.long}
#100以內的隨機int型別
rand.number = ${random.int(100)}
#0-10億範圍內的隨機int型別
rand.range = ${random.int[0,1000000000]}

java -jar beetltest-0.0.1-SNAPSHOT.jar -spring.config.location=classpath:/application.properties