Create a Java Application
In this solution, you'll be using the spring boot sample for spring-data-rest
. It is an easily available application that is simple, but has a few touch points that you can use to see and validate the Oracle Application Performance Monitoring features, such as tracing.
Throughout this process, you'll extend the build process to introduce Oracle Management Cloud to demonstrate that this integration can be done on existing applications without any changes to the application code. However, you'll not be editing the application source code itself.
- Obtain the source code.
git clone https://github.com/spring-guides/gs-accessing-data-rest.git
- From the cloned repository location, build the project and ensure that it runs by itself.
cd gs-accessing-data-rest/complete
./gradlew clean bootRun
The preceding lines of code download the required distribution of the gradle along with the application dependencies, compile, and run the application.
Note: If you are behind a corporate firewall and need to access the Internet using a proxy, then create a file called
gradle.properties
in the same location asbuild.gradle
and then populate it with your proxy information. - Set a project name in gradle by creating a file called
settings.gradle
in the current directory (typically,gs-accessing-data-rest/complete
) and adding the linerootProject.name="omc-sample-app"
or any valid value for the property. - Create an entry in the H2 database. The application uses the H2 database for persistence, which is empty out of the box.
curl -i -X POST -H "Content-Type:application/json" -d "{ \"firstName\" : \"Frodo\", \"lastName\" : \"Baggins\" }" http://localhost:8080/people
- Query the database to view its data.
curl http://localhost:8080/people