{"id":20408848,"url":"https://github.com/dockersamples/spring-postgres","last_synced_at":"2026-04-19T11:32:07.595Z","repository":{"id":253370592,"uuid":"843302132","full_name":"dockersamples/spring-postgres","owner":"dockersamples","description":"A Non-containerised Spring Boot app connected to Postgres","archived":false,"fork":false,"pushed_at":"2024-11-26T14:04:41.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-05T02:41:36.198Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dockersamples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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":"2024-08-16T08:06:58.000Z","updated_at":"2024-11-26T14:04:45.000Z","dependencies_parsed_at":"2024-08-16T09:30:48.689Z","dependency_job_id":"db3e3f77-bb82-4948-ab34-67a1c16dc17f","html_url":"https://github.com/dockersamples/spring-postgres","commit_stats":null,"previous_names":["dockersamples/spring-postgres"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dockersamples/spring-postgres","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dockersamples%2Fspring-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dockersamples%2Fspring-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dockersamples%2Fspring-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dockersamples%2Fspring-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dockersamples","download_url":"https://codeload.github.com/dockersamples/spring-postgres/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dockersamples%2Fspring-postgres/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32005506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":[],"created_at":"2024-11-15T05:37:23.942Z","updated_at":"2026-04-19T11:32:07.548Z","avatar_url":"https://github.com/dockersamples.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spring-postgres\n\nThis repository demonstrates the steps of seamlessly connecting a locally running Spring Boot application to a containerized PostgreSQL database, providing a practical foundation for your development projects. The overall project augment traditional development workflows. Developers maintain their familiar local development environments while offloading specific dependencies into isolated containers. This hybrid model optimizes resource utilization and enhances development efficiency.\n\n## Prerequisite:\n\n- [OpenJDK](https://www.java.com/en/download/)\n- [Docker Desktop](https://www.docker.com/products/docker-desktop/)\n- [Eclipse](https://www.eclipse.org/downloads/download.php)\n\n## Importing the project to Eclipse\n\nBefore you follow the steps, ensure that you clone the repository locally on your system.\n\n- Open Eclipse\n- Go to File -\u003e Import. \n- Select Maven -\u003e Existing Maven Projects.\n- Click Next.  \n- Browse to the root directory of your Spring Boot project.\n- Select the project and click Finish.\n\n## Build the application project\n\nRight-click on the main project and select “Maven Build” under “Run as”.\n\n```\n[INFO] Scanning for projects...\n[INFO]\n[INFO] [1m------------------------\u003c [0;36mcom.company:project[0;1m \u003e-------------------------[m\n[INFO] [1mBuilding New App 0.0.1-SNAPSHOT[m\n....\n---------------------------------------------------[m\n[INFO] [BUILD SUCCESS[m\n[INFO] [1m------------------------------------------------------------------------[m\n[INFO] Total time:  2.320 s\n[INFO] Finished at: 2024-08-15T19:22:25+05:30\n[INFO] [1m------------------------------------------------------------------------[m\n```\n\n\n\n## Running Postgres in a Docker container\n\n```\ndocker run --name postgres_container -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 -v postgres_data:/var/lib/postgresql/data postgres\n```\n\n## Configuring the application properties\n\nOpen `application.properties` in your project's `src/main/resources` directory. \nReplace the entries with the actual name of the Postgres host, database and credentials details.\n\n```\nspring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect\nspring.jpa.hibernate.ddl-auto=none\nspring.jpa.hibernate.show-sql=true\nspring.datasource.url=jdbc:postgresql://localhost:5432/postgres\nspring.datasource.username=postgres\nspring.datasource.password=mysecretpassword\nspring.datasource.initialization-mode=always\nspring.datasource.initialize=true\nspring.datasource.schema=classpath:/schema.sql\nspring.datasource.continue-on-error=true\n```\n\nSave the file once you make the changes by clicking on “Save” option in the top navigation.\n\n## Running the application\n\n- Running the Spring Boot application\n- Right-click on your project.\n- Select \"Run As\" -\u003e \"Maven Build\".\n- In the \"Goals\" field, enter `spring-boot:run`.\n\n## Verify if the Spring Boot is up and running.\n\n```\ncurl https://localhost:8080\nHello from Docker\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdockersamples%2Fspring-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdockersamples%2Fspring-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdockersamples%2Fspring-postgres/lists"}