zoukankan      html  css  js  c++  java
  • 开发框架 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}}}}

    欢迎指正:haizi2014@qq.com
  • 相关阅读:
    医院科室管理系统日志实现
    遍历hashmap
    java用于控制可见性的4个访问修饰符
    java中error和exception
    线程的状态
    线程间的通信
    位运算(1的个数;2.判断奇偶)
    24点组合
    Sequential 类的设备迁移
    gluon多线程迭代器
  • 原文地址:https://www.cnblogs.com/hcfan/p/10118013.html
Copyright © 2011-2022 走看看