Skip to content

Latest commit

 

History

History
29 lines (19 loc) · 1.18 KB

File metadata and controls

29 lines (19 loc) · 1.18 KB

Java SpringBoot REST API

Build and run on localhost

maven build with goals : clean package: generates target/helloworld2-0.0.1-SNAPSHOT.war

Right click on HelloworldApplication.java in eclipse - Run as Java Application

How to execute the REST API

  • http://localhost:12001/hello : Generate plain text result: Hello World from Java_SpringBoot
  • http://localhost:12001/operate/add/51/56 : Generate JSON object result: {"imeplementation": "Java_SpringBoot", "result": "107"}

Running on IBM Bluemix

Endpoint: https://api.ng.bluemix.net
cf push api-springboot -p target/helloworld2-0.0.1-SNAPSHOT.war

The REST API URL on Bleumix then becomes

Swagger Integration

Run http://localhost:12001/swagger-ui.html#/ or http://api-springboot.mybluemix.net/swagger-ui.html on bluemix

Swagger.json file: http://localhost:12001/v2/api-docs?group=springboot

Steps to integrate swagger with springboot: http://stackoverflow.com/a/35907962/5076414

Reference document for swagger integration: http://heidloff.net/article/usage-of-swagger-2-0-in-spring-boot-applications-to-document-apis/