{"id":18854773,"url":"https://github.com/astefanutti/spring-boot-camel-rest-jpa","last_synced_at":"2025-07-23T20:02:43.453Z","repository":{"id":74190913,"uuid":"65298884","full_name":"astefanutti/spring-boot-camel-rest-jpa","owner":"astefanutti","description":"Apache Camel REST / JPA Spring Boot example","archived":false,"fork":false,"pushed_at":"2018-02-05T09:58:12.000Z","size":72,"stargazers_count":15,"open_issues_count":2,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-14T10:49:46.280Z","etag":null,"topics":["camel","fabric8","jpa","kubernetes","mysql","openshift","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astefanutti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-09T13:52:21.000Z","updated_at":"2023-05-15T15:35:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"ae7b0a50-15ea-4481-9940-fea401b22652","html_url":"https://github.com/astefanutti/spring-boot-camel-rest-jpa","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/astefanutti/spring-boot-camel-rest-jpa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astefanutti%2Fspring-boot-camel-rest-jpa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astefanutti%2Fspring-boot-camel-rest-jpa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astefanutti%2Fspring-boot-camel-rest-jpa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astefanutti%2Fspring-boot-camel-rest-jpa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astefanutti","download_url":"https://codeload.github.com/astefanutti/spring-boot-camel-rest-jpa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astefanutti%2Fspring-boot-camel-rest-jpa/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266738508,"owners_count":23976436,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["camel","fabric8","jpa","kubernetes","mysql","openshift","spring-boot"],"created_at":"2024-11-08T03:51:15.572Z","updated_at":"2025-07-23T20:02:43.431Z","avatar_url":"https://github.com/astefanutti.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status][Travis badge]][Travis build]\n\n[Travis badge]: https://travis-ci.org/astefanutti/spring-boot-camel-rest-jpa.svg\n[Travis build]: https://travis-ci.org/astefanutti/spring-boot-camel-rest-jpa\n\n# Spring Boot Camel REST / JPA Example\n\nThis example demonstrates how to use JPA and Camel's REST DSL\nto expose a RESTful API that performs CRUD operations on a database.\n\nIt generates orders for books referenced in database at a regular pace.\nOrders are processed asynchronously by another Camel route. Books available\nin database as well as the status of the generated orders can be retrieved\nvia the REST API.\n\nThis example relies on the [Fabric8 Maven plugin](https://maven.fabric8.io)\nfor its build configuration and uses the\n[fabric8 Java base image](https://github.com/fabric8io-images/java).\nIt relies on Swagger to expose the API documentation of the REST service.\n\n## Build\n\nThe example can be built with:\n\n    $ mvn install\n\nThis automatically generates the application resource descriptors and builds\nthe Docker image against a running Docker daemon (which must be accessible either\nvia Unix Socket or with the URL set in `DOCKER_HOST`). Alternatively, when connected\nto an OpenShift cluster, then a Docker build is performed on OpenShift which at the end\ncreates an [ImageStream](https://docs.openshift.com/container-platform/3.6/architecture/core_concepts/builds_and_image_streams.html).\n\n## Run\n\n### Locally\n\nThe example can be run locally using the following Maven goal:\n\n    $ mvn spring-boot:run\n\nAlternatively, you can run the application locally using the executable\nJAR produced:\n\n    $ java -jar -Dspring.profiles.active=dev target/spring-boot-camel-rest-jpa-${project.version}.jar\n\nThis uses an embedded in-memory HSQLDB database. You can use the default\nSpring Boot profile in case you have a MySQL server available for you to test.\n\nYou can then access the REST API directly from your Web browser, e.g.:\n\n- \u003chttp://localhost:8080/camel-rest-jpa/books\u003e\n- \u003chttp://localhost:8080/camel-rest-jpa/books/order/1\u003e\n\n### Kubernetes\n\n#### Prerequisites\n\nIt is assumed a Kubernetes cluster is already running. The easiest way to setup\na local single-node Kubernetes cluster is to [install Minikube](https://github.com/kubernetes/minikube#installation) and run:\n\n    $ minikube start\n\nBesides, it is assumed that a MySQL service is already running on the platform.\nYou can deploy it using the provided deployment by executing:\n\n    $ kubectl create -f https://raw.githubusercontent.com/astefanutti/spring-boot-camel-rest-jpa/master/src/test/fabric8/mysql-kubernetes.yaml\n\nYou'll need to update the `MYSQL_USER` and `MYSQL_PASSWORD` environment variables in the template.\n\n#### Deployment\n\nThe example can be deployed by executing the following command:\n\n    $ mvn fabric8:deploy -Dmysql-service-username=\u003cusername\u003e -Dmysql-service-password=\u003cpassword\u003e\n\nThe `username` and `password` system properties correspond to the credentials\nused when deploying the MySQL database service.\n\nYou can then inspect the status of the deployment, e.g.:\n\n- To list all the running pods:\n    ```\n    $ kubectl get pods\n    ```\n\n- Then find the name of the pod that runs this example, and output the logs from the running pod with:\n    ```\n    $ kubectl logs \u003cpod_name\u003e\n    ```\n\n#### Runtime\n\n:pencil2:\n\n### OpenShift\n\n#### Prerequisites\n\nIt is assumed an OpenShift platform is already running. The easiest way to setup\na local single-node OpenShift cluster is to [install Minishift](https://github.com/minishift/minishift#installation) and run:\n\n    $ minishift start\n\nBesides, it is assumed that a MySQL service is already running on the platform.\nYou can deploy it using the provided deployment by executing:\n\n    $ oc create -f https://raw.githubusercontent.com/openshift/origin/master/examples/db-templates/mysql-ephemeral-template.json\n    $ oc new-app --template=mysql-ephemeral -p MYSQL_VERSION=5.6 -p MYSQL_USER=\u003cusername\u003e -p MYSQL_PASSWORD=\u003cpassword\u003e\n\nMore information can be found in [using the MySQL database image](https://docs.openshift.com/container-platform/3.6/using_images/db_images/mysql.html).\nYou may need to relax the security in your cluster as the MySQL container requires\nthe `setgid` access right permission. This can be achieved by running the following command:\n\n    $ oc adm policy add-scc-to-group anyuid system:authenticated\n\nThat grants all authenticated users access to the `anyuid` SCC. You can find\nmore information in [Managing Security Context Constraints](https://docs.openshift.com/container-platform/3.6/admin_guide/manage_scc.html).\nFor this command to run successfully, you would need to be logged in with a user that has the\n`cluster-admin` role bound, e.g. with the default system account:\n\n    $ oc login https://$(minishift ip):8443 -u system:admin\n\nIn case you need / want to access the Web console with a privileged account, you can create\nan admin user account with:\n\n```sh\n$ oc adm policy add-cluster-role-to-user cluster-admin admin\n# oc login -u admin -p admin\n```\n\n#### Deployment\n\nThe example can be deployed by executing the following command:\n\n    $ mvn fabric8:deploy -Dmysql-service-username=\u003cusername\u003e -Dmysql-service-password=\u003cpassword\u003e\n\nThe `username` and `password` system properties correspond to the credentials\nused when deploying the MySQL database service.\n\nThis streams the pod logs into the console. Alternatively, you can use the\nOpenShift client tool to inspect the status, e.g.:\n\n- To list all the running pods:\n    ```\n    $ oc get pods\n    ```\n\n- Then find the name of the pod that runs this example, and output the logs from the running pod with:\n    ```\n    $ oc logs \u003cpod_name\u003e\n    ```\n\n#### Runtime\n\n##### REST service\n\nWhen the example is running, a REST service is available to list the books\nthat can be ordered, and as well the order statuses.\nAs it depends on your OpenShift setup, the hostname for the route\nmay vary. You can retrieve it by running the following command:\n\n    $ oc get routes -o jsonpath='{range .items[?(@.spec.to.name == \"camel-rest-jpa\")]}{.spec.host}{\"\\n\"}{end}'\n\nThe actual endpoint is using the _context-path_ `camel-rest-jpa/books` and\nthe REST service provides two services:\n\n- `books`: to list all the available books that can be ordered,\n- `books/order/{id}`: to output order status for the given order `id`.\n\nThe example automatically creates new orders with a running order `id`\nstarting from 1.\nYou can then access these services from your Web browser, e.g.:\n\n- [http://\u003croute_hostname\u003e/camel-rest-jpa/books](http://route_hostname/camel-rest-jpa/books)\n- [http://\u003croute_hostname\u003e/camel-rest-jpa/books/order/1](http://route_hostname/camel-rest-jpa/books/order/1)\n\n##### Swagger API\n\nThe example provides API documentation of the service using Swagger using\nthe _context-path_ `camel-rest-jpa/api-doc`. You can access the API documentation\nfrom your Web browser at [http://\u003croute_hostname\u003e/camel-rest-jpa/api-doc](http://route_hostname/camel-rest-jpa/api-doc).\n\n## Test\n\n### Locally\n\nThe tests can be executed with:\n\n    $ mvn surefire:test\n\nThis starts the application by picking an available port at random and executes the tests.\n\n### Kubernetes\n\n:pencil2:\n\n### OpenShift\n\nThis requires to have an OpenShift environment running.\nDepending on the authentication scheme of your environment, you may need to configure\nthe test client access.\n\nMinishift relies on the default [identity provider](https://docs.openshift.com/container-platform/3.6/install_config/configuring_authentication.html#AllowAllPasswordIdentityProvider),\nso that you can create a user for the test execution just by logging in, e.g.:\n\n    $ oc login -u test -p test\n\nAnd then execute the integration tests with:\n\n    $ mvn failsafe:integration-test\n\nNote that the test user requires to have the `basic-user` role bound, so that it can\ncreate the project in which the application and the MySQL server get deployed prior\nto the test execution.\nCluster roles can be viewed as documented in [Viewing Cluster Policy](https://docs.openshift.com/container-platform/3.6/admin_guide/manage_authorization_policy.html#viewing-cluster-policy).\n\nFinally, it may be handy to keep the project created for the test execution.\nThis can be achieved by setting the `namespace.cleanup.enabled` system variable\nto `false`, e.g.:\n\n    $ mvn failsafe:integration-test -Dnamespace.cleanup.enabled=false\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastefanutti%2Fspring-boot-camel-rest-jpa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastefanutti%2Fspring-boot-camel-rest-jpa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastefanutti%2Fspring-boot-camel-rest-jpa/lists"}