开发框架 springBoot

1.多个环境的配置文件

在application.yml 中配置需要调用的配置文件

spring:
  profiles:
    active: dev

运行方式的,先运行application.yml 再根据active指定的配置文件,进行覆盖。

linux中启动程序指定配置文件

java -jar springbootdemo.jar -- spring.profiles.active=dev

2.运行状态监控Actuator

pom中引入依赖

<!--运行状态监控-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

在application.yml文件中配置

management:
  endpoints:
    web:
      exposure:
        include: "*"
  server:
    port: 10111
    servlet:
      context-path: /
    ssl:
      enabled: false
  endpoint:
    health:
      show-details: always

访问方式:http://localhost:10111/actuator/health

访问结果:

{"status":"UP","details":{"db":{"status":"UP","details":{"database":"MySQL","hello":1}},"diskSpace":{"status":"UP","details":{"total":463330078720,"free":113779286016,"threshold":10485760}}}}

 

posted @ 2018-12-14 10:30  点点_滴滴  阅读(233)  评论(0编辑  收藏  举报