1.application.yml修改,示例:
#通用配置
spring:
profiles:
active: dev
#开发环境
server:
port: 8769
euteka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
spring:
profiles: dev
application:
name: cloud-user
datasource:
username: root
password: Myjr678!@#
url: jdbc:mysql://111.62.41.157:3306/ygxttest1?useUnicode=true&characterEncoding=utf-8
driver-class-name: com.mysql.jdbc.Driver
mybatis:
mapper-locations: classpath:mapper/*.xml
logging:
level:
com:
cloud:
attendanceserver:
mapper: debug
#生产环境
server:
port: 8763
euteka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
spring:
profiles: prod
application:
name: cloud-user
datasource:
username: root
password: Myjr678!@#
url: jdbc:mysql://111.62.41.157:3306/ygxttest1?useUnicode=true&characterEncoding=utf-8
driver-class-name: com.mysql.jdbc.Driver
mybatis:
mapper-locations: classpath:mapper/*.xml
logging:
level:
com:
cloud:
attendanceserver:
mapper: debug
2.eclipse上点击project ,settings
再点击edit
3.运行项目
部署:
java -jar spring-boot-02-config-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev;