spring boot版本2.0.0
spring cloud版本finchley
1. 起一个config server, 略
2. 创建一个config-client模块,
bootstrap.yml简单配置如下:
spring: application: name: config-client cloud: config: enabled: true uri: http://localhost:8781 profile: prod
其中uri为config-server地址,
关键是application.yml配置:
server: port: 8861 eureka: client: service-url: default: http://localhost:8761/eureka/ management: endpoints: web: exposure: include: "*"
斜体加粗部分是关键配置, 启动工程后访问 http://localhost:8861/actuator/refresh即可刷新配置,
include: "*" 暴露了全部的管理接口,可用的其他接口还有:
/actuator/archaius],methods=[GET]
/actuator/auditevents],methods=[GET]
/actuator/beans],methods=[GET]
/actuator/health],methods=[GET]
/actuator/conditions],methods=[GET]
/actuator/configprops],methods=[GET]
/actuator/env],methods=[GET]
/actuator/env/{toMatch}],methods=[GET]
/actuator/env],methods=[POST]
/actuator/env],methods=[DELETE]
/actuator/info],methods=[GET]
/actuator/loggers],methods=[GET]
/actuator/loggers/{name}],methods=[GET]
/actuator/loggers/{name}],methods=[POST]
/actuator/heapdump],methods=[GET]
/actuator/threaddump],methods=[GET]
/actuator/metrics/{requiredMetricName}],methods=[GET]
/actuator/metrics],methods=[GET]
/actuator/scheduledtasks],methods=[GET]
/actuator/httptrace],methods=[GET]
/actuator/mappings],methods=[GET]
/actuator/refresh],methods=[POST]
/actuator/features],methods=[GET]
/actuator/service-registry],methods=[GET]
/actuator/service-registry],methods=[POST]
/actuator],methods=[GET]