项目作者: darienmt

项目描述 :
Simple Spring Boot Actuator REST-full service
高级语言: Java
项目地址: git://github.com/darienmt/spring-boot-actuator-hello-world.git
创建时间: 2018-03-14T04:10:05Z
项目社区:https://github.com/darienmt/spring-boot-actuator-hello-world

开源协议:MIT License

下载


Spring Boot Actuator Hello-world

Simple Spring Boot Actuator REST-full service

Based on the tutorial Building a RESTfull Web Service with Spring Boot Actuator, it will be use a sample Java application on different places where it is needed.
All the Actuator end-points are enable. For more information about Spring Boot Actuator click here

Compiling, unit test and package

  1. $ mvn clean compile test package

Running

  1. $ java -jar target/gs-actuator-service-0.1.0.jar

Testing connectivity

/hello-world

  1. $ curl localhost:9000/hello-world | python -m json.tool
  2. % Total % Received % Xferd Average Speed Time Time Time Current
  3. Dload Upload Total Spent Left Speed
  4. 100 37 0 37 0 0 3301 0 --:--:-- --:--:-- --:--:-- 4111
  5. {
  6. "id": 1,
  7. "content": "Hello, Stranger!"
  8. }

Not Found

  1. $ curl localhost:9000/abcd | python -m json.tool
  2. % Total % Received % Xferd Average Speed Time Time Time Current
  3. Dload Upload Total Spent Left Speed
  4. 100 125 0 125 0 0 16497 0 --:--:-- --:--:-- --:--:-- 31250
  5. {
  6. "timestamp": "2000-01-01T01:01:01.0001+0000",
  7. "status": 404,
  8. "error": "Not Found",
  9. "message": "No message available",
  10. "path": "/abcd"
  11. }

/actuator/health

  1. $ curl localhost:9001/actuator/health | python -m json.tool
  2. % Total % Received % Xferd Average Speed Time Time Time Current
  3. Dload Upload Total Spent Left Speed
  4. 100 15 0 15 0 0 2393 0 --:--:-- --:--:-- --:--:-- 5000
  5. {
  6. "status": "UP"
  7. }