This folder is the BTP Simple Demo Application for Java Applicaiton. we can use this demo to familiary with the SAP BTP Java Development Lifecycle.
After that , you can directly user the template for further development or build another applicaitons with you own development
Use this link to apply and setup the BTP trial or enterpise enviroment
Java
Install and setup the Java JDK1.8 or higher
Maven
Install and setup Maven 3.5.0 or higher
IDE
we can use the Eclipse, Idea , Theia or VSC as you favourite development IDE, or other IDE you want.
-
Eclipse
Install the STS tools fomr you Eclipse IDE
-
Idea
Idea already Integrate the SpringBoot Intializer, no more configuration needed
-
VSC
Install the SpringBoot Pack Extention , and Java Extention, or Spring Boot Developer pack, follow this instruction to configue the java runtime
-
Theia
As alternative IDF fo VSC under Eclpse orgnization, and it is still in Beta development , if you want to be the first bird , we can try it.
CF Command line
Dowanload and Configration : Download and Install the Cloud Foundry Command Line Interface
Direct Download link: https://github.com/cloudfoundry/cli#downloads
Steps :
-
create Spring Boot application via SpringBoot Intializer. In this Simple Application , here are the information we configured:
groupId : onem.seya artifactId: javademo
-
Add Dependency, Spirng Web + Rest Repository
-
create controllerfolder and add the class HelloWorldController
-
Add the sample code and save it
@RestController @RequestMapping(HelloWorldController.PATH) public class HelloWorldController { public static final String PATH = "/api"; @GetMapping(value = "/welcome") public String printHelloWord() { String welcomeMessage = "Hello, this is BTP SAP JAVA Simple Demo"; return welcomeMessage; } }
build java application package with the command line mvn package
Run java application package with command line Java -jar XXXX.jar
Test it with the link : http://localhost:8080/api/welcome
and get the response.
Hello, this is BTP SAP JAVA Simple Demo
After that , this whole java applciation is working fine
Deploy for BTP:
-
set cloud foundry endpoint command :
cf api {EndpointURL}
-
login to your BTP endpoint with your btp user and password command :
cf login
-
add manifest.yml for CF BTP development
-
configure the route and java buildpacks
here we suggest use bellow format as recomendation :
{subdomain}-{appname}.{cfappdoman}
subdomain:
appname: defined by yourself
cfappsdomain: user the command cf domains
to get the domain url
Example:
---
applications:
- name: demo
memory: 400M
path: target/btp_JavaApplicatin.jar
instances: 1
buildpacks:
- sap_java_buildpack
env:
TARGET_RUNTIME: tomee7
routes:
- route: 91ccc175trial-demo.cfapps.ap21.hana.ondemand.com
-
Deploy your jar packges to your BTP Subaccount
command :
cf push
- Navigte to your space
- Go you applcation
- Get applicaiton URL
-
Test it with the URL
{applicaitonURL}/api/welcome
After get the below response, then your application is runtime fine
Hello, this is BTP SAP JAVA Simple Demo
SpringBoot Rest Service Guide : SpringBoot Rest Service Guide
SAP BTP JAVA Development: Developing Java in the Cloud Foundry Environment