{"id":26486856,"url":"https://github.com/luismr/docker-for-devs-5-java-springboot-with-local-test-and-prod-envs","last_synced_at":"2026-04-10T12:04:08.095Z","repository":{"id":145600561,"uuid":"571345292","full_name":"luismr/docker-for-devs-5-java-springboot-with-local-test-and-prod-envs","owner":"luismr","description":"Spring Boot 2.7 using Rest Repository for JPA using H2 in memory database - NO CONTROLLER - it is automatically generated/handled by Spring Data Rest. This application (Challenge #2) will run in local (H2 persistent), test (H2 transient - for CI/CD) and Prod (MariaDB)","archived":false,"fork":false,"pushed_at":"2022-11-28T03:58:32.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-03T21:18:14.865Z","etag":null,"topics":["java","jpa","jpa-entities","rest-api","rest-api-framework","spring-boot","springboot"],"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/luismr.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":"2022-11-27T22:55:01.000Z","updated_at":"2022-11-27T23:02:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"551a9706-e77d-4746-a0b6-9d0bd771802d","html_url":"https://github.com/luismr/docker-for-devs-5-java-springboot-with-local-test-and-prod-envs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/luismr/docker-for-devs-5-java-springboot-with-local-test-and-prod-envs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luismr%2Fdocker-for-devs-5-java-springboot-with-local-test-and-prod-envs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luismr%2Fdocker-for-devs-5-java-springboot-with-local-test-and-prod-envs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luismr%2Fdocker-for-devs-5-java-springboot-with-local-test-and-prod-envs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luismr%2Fdocker-for-devs-5-java-springboot-with-local-test-and-prod-envs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luismr","download_url":"https://codeload.github.com/luismr/docker-for-devs-5-java-springboot-with-local-test-and-prod-envs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luismr%2Fdocker-for-devs-5-java-springboot-with-local-test-and-prod-envs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31641493,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["java","jpa","jpa-entities","rest-api","rest-api-framework","spring-boot","springboot"],"created_at":"2025-03-20T06:30:11.993Z","updated_at":"2026-04-10T12:04:08.090Z","avatar_url":"https://github.com/luismr.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Getting Started\n\n## Requirements\n\nYou can use [SDKMAN](https://sdkman.io/) to manage your Java and Maven runtimes, and there is a very good tutorial about how to use SDKMAN [here](https://www.baeldung.com/java-sdkman-intro).\n\n* Java 17\n\n```shell\nsdk install java 17.0.3.6.1-amzn\n```\n\n* Maven 3.8.5\n\n```shell\nsdk install maven 3.8.5\n```\n\n## Build and Run\n\n### Using Maven\n\n#### Build\n\n```shell\nmvn clean install\n```\n\n#### Running only the Tests\n\n```shell\nmvn test\n```\n\n#### Running the application\n\n##### Test Environment\n\nTest environment will use H2SQL in memory mode to persist your test data\n\n```shell\nmvn spring-boot:run\n```\n\nor using just Java\n```shell\nmvn clean install\njava -jar target/api-crud-1.0-SNAPSHOT.jar \n```\n\n##### Local Environment\n\nLocal environment will use H2SQL in file to persist your changes\n\n```shell\nmvn spring-boot:run -Dspring-boot.run.profiles=local\n```\n\nor using just Java\n```shell\nmvn clean install\njava -jar -Dspring.profiles.active=local target/api-crud-1.0-SNAPSHOT.jar \n```\n\n##### Prod Environment\n\nRunning Docker MariaDB to provide Database support and run the application using your own Machine (for test and debug)\n\n- To create the MariaDB container, if it is not created\n```shell\ndocker run --name db -d -e MARIADB_ROOT_PASSWORD=password -e MARIADB_DATABASE=mydb mariadb:latest\n```\n- To stop the MariaDB container, if the container is already running\n```shell\ndocker stop db\n```\n- To restart the MariaDB container, if the container is already created do\n```shell\ndocker start db\n```\n- To remove the MariaDB container, stop the container first and then\n```shell\ndocker rm db\n```\n\nThen, start the application using maven\n```shell\nmvn spring-boot:run -Dspring-boot.run.profiles=deploy\n```\n... or execute directly from the JAR file, after you build it usinbg maven\n```shell\nmvn clean install\njava -jar -Dspring.profiles.active=deploy target/api-crud-1.0-SNAPSHOT.jar \n```\n\nTo customize the deploy to connect in another `MYSQL` database, please set these **environment variables**:\n- **MYSQL_HOST**: connects to the defined host (_default **localhost**_)\n- **MYSQL_PORT**: connects to the defined port (_default **3306**_)\n- **MYSQL_DATABASE**: select the database as default for opened connection (_default **mydb**_)\n- **MYSQL_USERNAME**: connects to database using the username (_default **root**_)\n- **MYSQL_PASSWORD**: connects to database using the username (_default **password**_)\n- **SQL_QUERIES_SHOW**: show all SQL statements generated by JPA (_default **false**_)\n- **SQL_QUERIES_FORMAT**: pretty format all SQL statements generated by JPA (_default **false**_)\n\nExample:\n```shell\nexport MYSQL_HOST=mydb.internal.net\nexport MYSQL_DATABASE=customer_data\nexport MYSQL_USERNAME=customers\nexport MYSQL_PASSWORD=str0ngp@ssw0rd\nexport SQL_QUERIES_SHOW=true\nexport SQL_QUERIES_FORMAT=true \njava -jar -Dspring.profiles.active=deploy target/api-crud-1.0-SNAPSHOT.jar \n```\n\nIt works because the `application-deploy.yml` profile has placeholders to find the value from the environment variables or use a _default value_. Please realize when you create your local MariaDB container you set the all parameters to match default profile values.\n\n### Using IDE\n\nI used [IntelliJ Idea](https://www.jetbrains.com/idea/) from [JetBrains](https://www.jetbrains.com/)  to build this application but you also can use [Eclipse](https://www.eclipse.org/downloads/), or [Netbeans](https://netbeans.apache.org/download/index.html) to run this application.\n\n\n## Documentation\n\n### References\n\nFor further reference, please consider the following sections:\n\n* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)\n* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.7.1/maven-plugin/reference/html/)\n* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.7.1/maven-plugin/reference/html/#build-image)\n* [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/2.7.1/reference/htmlsingle/#using.devtools)\n* [Spring Web](https://docs.spring.io/spring-boot/docs/2.7.1/reference/htmlsingle/#web)\n\n### Guides\n\nThe following guides illustrate how to use some features concretely:\n\n* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)\n* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)\n* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)\n* [How to use SDKMAN](https://www.baeldung.com/java-sdkman-intro)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluismr%2Fdocker-for-devs-5-java-springboot-with-local-test-and-prod-envs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluismr%2Fdocker-for-devs-5-java-springboot-with-local-test-and-prod-envs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluismr%2Fdocker-for-devs-5-java-springboot-with-local-test-and-prod-envs/lists"}