{"id":21581549,"url":"https://github.com/thoughtscript/java_spring_boot_2024","last_synced_at":"2026-04-10T02:02:22.202Z","repository":{"id":238619516,"uuid":"796971954","full_name":"Thoughtscript/java_spring_boot_2024","owner":"Thoughtscript","description":"Basic Spring Boot practice","archived":false,"fork":false,"pushed_at":"2024-12-29T23:20:11.000Z","size":88,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-24T14:45:05.758Z","etag":null,"topics":["docker","docker-compose","java","postgresql","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/Thoughtscript.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":"2024-05-07T00:51:30.000Z","updated_at":"2024-12-31T12:43:57.000Z","dependencies_parsed_at":"2024-05-07T04:32:50.129Z","dependency_job_id":"623cd422-8bf9-44f9-b2ad-7a466899377b","html_url":"https://github.com/Thoughtscript/java_spring_boot_2024","commit_stats":null,"previous_names":["thoughtscript/java_spring_boot_2024"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thoughtscript%2Fjava_spring_boot_2024","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thoughtscript%2Fjava_spring_boot_2024/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thoughtscript%2Fjava_spring_boot_2024/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thoughtscript%2Fjava_spring_boot_2024/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Thoughtscript","download_url":"https://codeload.github.com/Thoughtscript/java_spring_boot_2024/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244181391,"owners_count":20411605,"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","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":["docker","docker-compose","java","postgresql","spring-boot"],"created_at":"2024-11-24T14:12:54.005Z","updated_at":"2025-12-31T00:16:00.784Z","avatar_url":"https://github.com/Thoughtscript.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Boot 2024\n\n[![](https://img.shields.io/badge/Spring%20Boot-3.5.0-green.svg)](https://spring.io/projects/spring-boot)\n[![](https://img.shields.io/badge/Gradle-7.5.1-darkslategray.svg)](https://gradle.org/)\n[![](https://img.shields.io/badge/Maven-3.9.9-white.svg)](https://maven.apache.org/download.cgi)\n[![](https://img.shields.io/badge/Docker-blue.svg)](https://www.docker.com/) \n[![](https://img.shields.io/badge/Postgres-16.2-lightblue.svg)](https://hub.docker.com/_/postgres)\n\n## Use\n\n### Docker Compose\n\n```bash\ndocker-compose up\n\n# If using Docker Compose Engine V2:\ndocker compose up\n```\n\n### From Source\n\nMaven:\n```bash\nmvn clean\nmvn install\nmvn spring-boot:run\n```\n\nGradle:\n```bash\n./gradlew clean\n./gradlew build\n./gradlew run\n```\n\nSSL:\n```bash\nkeytool -genkey \\\n  -alias bootexample \\\n  -keystore bootexample.p12 \\\n  -storetype PKCS12 \\\n  -keyalg RSA \\\n  -storepass af3DF*34afefwefehu \\\n  -validity 730 \\\n  -keysize 4096\n```\n\n### Default Credentials\n\n\u003e Some default credentials are supplied (to simplify spinning up the example). These are \"dummy\" credentials (although valid) and aren't or shouldn't be used in any live or PRODUCTION deployment. (In a real-world enterprise app, such credentials would be stored in a service like AWS KMS and be made available or injected during the build.)\n\n1. [springboot/src/main/resources/application.yml](springboot/src/main/resources/application.yml)\n2. [springboot/src/main/java/io/thoughtscript/bootexample/config/SecurityConfiguration.java](springboot/src/main/java/io/thoughtscript/bootexample/config/SecurityConfiguration.java)\n    * `user` and `password` are the default Spring Security credentials. Use them to log in and call the API as needed.\n3. [postgresql/init_sql.sql](postgresql/init_sql.sql)\n\n### Comments\n\n1. Uses Hikari [Connection Pooling](/springboot/src/main/resources/application.yml#L35) and postgres [Max Connections](docker-compose.yml#L6)\n2. Uses `@EnableCaching` through [Spring Cache](springboot/src/main/java/io/thoughtscript/bootexample/config/CacheConfiguration.java#L7)\n3. Uses Virtual Threads through [application.yml](springboot/src/main/resources/application.yml#L39)\n4. Uses Hibernate `@Cacheable` within the Entity Framework [domain](springboot/src/main/java/io/thoughtscript/bootexample/domain/ManyToManyRelation.java#L20)\n5. Uses `@Transactional(readOnly = true)` on [Services](springboot/src/main/java/io/thoughtscript/bootexample/services/ManyToManyRelationService.java#L14)\n\n## API\n\nEndpoint testing is supplied through `bash`:\n\n```bash\nbash test_curl.sh\n```\n\n### Get All Examples\n\nhttps://localhost:8080/api/example/all\n\n```JSON\n[\n    {\n        \"id\": 1,\n        \"name\": \"aa\",\n        \"oneToOneRelation\": {\n            \"id\": 1,\n            \"name\": \"a\"\n        },\n        \"oneToManyRelations\": [\n            {\n                \"id\": 1,\n                \"name\": \"aaa\",\n                \"examplefk\": 1\n            },\n            {\n                \"id\": 2,\n                \"name\": \"bbb\",\n                \"examplefk\": 1\n            }\n        ],\n        \"manyonerelationfk\": 1,\n        \"manyToManyRelations\": [\n            {\n                \"id\": 1,\n                \"name\": \"aaaaa\"\n            },\n            {\n                \"id\": 2,\n                \"name\": \"bbbbb\"\n            }\n        ]\n    },\n    {\n        \"id\": 2,\n        \"name\": \"bb\",\n        \"oneToOneRelation\": {\n            \"id\": 2,\n            \"name\": \"b\"\n        },\n        \"oneToManyRelations\": [\n            {\n                \"id\": 3,\n                \"name\": \"ccc\",\n                \"examplefk\": 2\n            },\n            {\n                \"id\": 4,\n                \"name\": \"ddd\",\n                \"examplefk\": 2\n            }\n        ],\n        \"manyonerelationfk\": 2,\n        \"manyToManyRelations\": []\n    },\n    {\n        \"id\": 3,\n        \"name\": \"cc\",\n        \"oneToOneRelation\": {\n            \"id\": 3,\n            \"name\": \"c\"\n        },\n        \"oneToManyRelations\": [\n            {\n                \"id\": 5,\n                \"name\": \"aaa\",\n                \"examplefk\": 3\n            },\n            {\n                \"id\": 6,\n                \"name\": \"bbb\",\n                \"examplefk\": 3\n            }\n        ],\n        \"manyonerelationfk\": 3,\n        \"manyToManyRelations\": []\n    },\n    {\n        \"id\": 4,\n        \"name\": \"dd\",\n        \"oneToOneRelation\": {\n            \"id\": 4,\n            \"name\": \"d\"\n        },\n        \"oneToManyRelations\": [\n            {\n                \"id\": 7,\n                \"name\": \"ccc\",\n                \"examplefk\": 4\n            },\n            {\n                \"id\": 8,\n                \"name\": \"ddd\",\n                \"examplefk\": 4\n            }\n        ],\n        \"manyonerelationfk\": 4,\n        \"manyToManyRelations\": []\n    },\n    {\n        \"id\": 52,\n        \"name\": \"aa\",\n        \"oneToOneRelation\": {\n            \"id\": 52,\n            \"name\": \"a\"\n        },\n        \"oneToManyRelations\": [\n            {\n                \"id\": 52,\n                \"name\": \"aaa\",\n                \"examplefk\": 52\n            },\n            {\n                \"id\": 53,\n                \"name\": \"bbb\",\n                \"examplefk\": 52\n            }\n        ],\n        \"manyonerelationfk\": 52,\n        \"manyToManyRelations\": [\n            {\n                \"id\": 52,\n                \"name\": \"aaaaa\"\n            },\n            {\n                \"id\": 53,\n                \"name\": \"bbbbb\"\n            }\n        ]\n    },\n    {\n        \"id\": 53,\n        \"name\": \"bb\",\n        \"oneToOneRelation\": {\n            \"id\": 53,\n            \"name\": \"b\"\n        },\n        \"oneToManyRelations\": [\n            {\n                \"id\": 54,\n                \"name\": \"ccc\",\n                \"examplefk\": 53\n            },\n            {\n                \"id\": 55,\n                \"name\": \"ddd\",\n                \"examplefk\": 53\n            }\n        ],\n        \"manyonerelationfk\": 53,\n        \"manyToManyRelations\": []\n    },\n    {\n        \"id\": 54,\n        \"name\": \"cc\",\n        \"oneToOneRelation\": {\n            \"id\": 54,\n            \"name\": \"c\"\n        },\n        \"oneToManyRelations\": [\n            {\n                \"id\": 56,\n                \"name\": \"aaa\",\n                \"examplefk\": 54\n            },\n            {\n                \"id\": 57,\n                \"name\": \"bbb\",\n                \"examplefk\": 54\n            }\n        ],\n        \"manyonerelationfk\": 54,\n        \"manyToManyRelations\": []\n    },\n    {\n        \"id\": 55,\n        \"name\": \"dd\",\n        \"oneToOneRelation\": {\n            \"id\": 55,\n            \"name\": \"d\"\n        },\n        \"oneToManyRelations\": [\n            {\n                \"id\": 58,\n                \"name\": \"ccc\",\n                \"examplefk\": 55\n            },\n            {\n                \"id\": 59,\n                \"name\": \"ddd\",\n                \"examplefk\": 55\n            }\n        ],\n        \"manyonerelationfk\": 55,\n        \"manyToManyRelations\": []\n    }\n]\n```\n\n### Get All Many To Many Relations\n\nhttps://localhost:8080/api/relations/many/many/all\n\nSuppressed `List\u003cExample\u003e` field.\n\n```JSON\n[\n    {\n        \"id\": 1,\n        \"name\": \"aaaaa\"\n    },\n    {\n        \"id\": 2,\n        \"name\": \"bbbbb\"\n    },\n    {\n        \"id\": 3,\n        \"name\": \"ccccc\"\n    },\n    {\n        \"id\": 4,\n        \"name\": \"ddddd\"\n    },\n    {\n        \"id\": 52,\n        \"name\": \"aaaaa\"\n    },\n    {\n        \"id\": 53,\n        \"name\": \"bbbbb\"\n    },\n    {\n        \"id\": 54,\n        \"name\": \"ccccc\"\n    },\n    {\n        \"id\": 55,\n        \"name\": \"ddddd\"\n    }\n]\n```\n\n### Get All One To Many Relations\n\nhttps://localhost:8080/api/relations/one/many/all\n\n```JSON\n[\n    {\n        \"id\": 1,\n        \"name\": \"aaa\",\n        \"examplefk\": 1\n    },\n    {\n        \"id\": 2,\n        \"name\": \"bbb\",\n        \"examplefk\": 1\n    },\n    {\n        \"id\": 3,\n        \"name\": \"ccc\",\n        \"examplefk\": 2\n    },\n    {\n        \"id\": 4,\n        \"name\": \"ddd\",\n        \"examplefk\": 2\n    },\n    {\n        \"id\": 5,\n        \"name\": \"aaa\",\n        \"examplefk\": 3\n    },\n    {\n        \"id\": 6,\n        \"name\": \"bbb\",\n        \"examplefk\": 3\n    },\n    {\n        \"id\": 7,\n        \"name\": \"ccc\",\n        \"examplefk\": 4\n    },\n    {\n        \"id\": 8,\n        \"name\": \"ddd\",\n        \"examplefk\": 4\n    },\n    {\n        \"id\": 52,\n        \"name\": \"aaa\",\n        \"examplefk\": 52\n    },\n    {\n        \"id\": 53,\n        \"name\": \"bbb\",\n        \"examplefk\": 52\n    },\n    {\n        \"id\": 54,\n        \"name\": \"ccc\",\n        \"examplefk\": 53\n    },\n    {\n        \"id\": 55,\n        \"name\": \"ddd\",\n        \"examplefk\": 53\n    },\n    {\n        \"id\": 56,\n        \"name\": \"aaa\",\n        \"examplefk\": 54\n    },\n    {\n        \"id\": 57,\n        \"name\": \"bbb\",\n        \"examplefk\": 54\n    },\n    {\n        \"id\": 58,\n        \"name\": \"ccc\",\n        \"examplefk\": 55\n    },\n    {\n        \"id\": 59,\n        \"name\": \"ddd\",\n        \"examplefk\": 55\n    }\n]\n````\n\n### Get All One To One Relations\n\nhttps://localhost:8080/api/relations/one/one/all\n\n```JSON\n[\n    {\n        \"id\": 1,\n        \"name\": \"a\"\n    },\n    {\n        \"id\": 2,\n        \"name\": \"b\"\n    },\n    {\n        \"id\": 3,\n        \"name\": \"c\"\n    },\n    {\n        \"id\": 4,\n        \"name\": \"d\"\n    },\n    {\n        \"id\": 52,\n        \"name\": \"a\"\n    },\n    {\n        \"id\": 53,\n        \"name\": \"b\"\n    },\n    {\n        \"id\": 54,\n        \"name\": \"c\"\n    },\n    {\n        \"id\": 55,\n        \"name\": \"d\"\n    }\n]\n```\n\n### Get All Many To One Relations\n\nhttps://localhost:8080/api/relations/many/one/all\n\n```JSON\n[\n    {\n        \"id\": 1,\n        \"name\": \"aaaa\",\n        \"example\": {\n            \"id\": 1,\n            \"name\": \"aa\",\n            \"oneToOneRelation\": {\n                \"id\": 1,\n                \"name\": \"a\"\n            },\n            \"oneToManyRelations\": [\n                {\n                    \"id\": 1,\n                    \"name\": \"aaa\",\n                    \"examplefk\": 1\n                },\n                {\n                    \"id\": 2,\n                    \"name\": \"bbb\",\n                    \"examplefk\": 1\n                }\n            ],\n            \"manyonerelationfk\": 1,\n            \"manyToManyRelations\": [\n                {\n                    \"id\": 1,\n                    \"name\": \"aaaaa\"\n                },\n                {\n                    \"id\": 2,\n                    \"name\": \"bbbbb\"\n                }\n            ]\n        }\n    },\n    {\n        \"id\": 2,\n        \"name\": \"bbbb\",\n        \"example\": {\n            \"id\": 2,\n            \"name\": \"bb\",\n            \"oneToOneRelation\": {\n                \"id\": 2,\n                \"name\": \"b\"\n            },\n            \"oneToManyRelations\": [\n                {\n                    \"id\": 3,\n                    \"name\": \"ccc\",\n                    \"examplefk\": 2\n                },\n                {\n                    \"id\": 4,\n                    \"name\": \"ddd\",\n                    \"examplefk\": 2\n                }\n            ],\n            \"manyonerelationfk\": 2,\n            \"manyToManyRelations\": []\n        }\n    },\n    {\n        \"id\": 3,\n        \"name\": \"cccc\",\n        \"example\": {\n            \"id\": 3,\n            \"name\": \"cc\",\n            \"oneToOneRelation\": {\n                \"id\": 3,\n                \"name\": \"c\"\n            },\n            \"oneToManyRelations\": [\n                {\n                    \"id\": 5,\n                    \"name\": \"aaa\",\n                    \"examplefk\": 3\n                },\n                {\n                    \"id\": 6,\n                    \"name\": \"bbb\",\n                    \"examplefk\": 3\n                }\n            ],\n            \"manyonerelationfk\": 3,\n            \"manyToManyRelations\": []\n        }\n    },\n    {\n        \"id\": 4,\n        \"name\": \"dddd\",\n        \"example\": {\n            \"id\": 4,\n            \"name\": \"dd\",\n            \"oneToOneRelation\": {\n                \"id\": 4,\n                \"name\": \"d\"\n            },\n            \"oneToManyRelations\": [\n                {\n                    \"id\": 7,\n                    \"name\": \"ccc\",\n                    \"examplefk\": 4\n                },\n                {\n                    \"id\": 8,\n                    \"name\": \"ddd\",\n                    \"examplefk\": 4\n                }\n            ],\n            \"manyonerelationfk\": 4,\n            \"manyToManyRelations\": []\n        }\n    },\n    {\n        \"id\": 52,\n        \"name\": \"aaaa\",\n        \"example\": {\n            \"id\": 52,\n            \"name\": \"aa\",\n            \"oneToOneRelation\": {\n                \"id\": 52,\n                \"name\": \"a\"\n            },\n            \"oneToManyRelations\": [\n                {\n                    \"id\": 52,\n                    \"name\": \"aaa\",\n                    \"examplefk\": 52\n                },\n                {\n                    \"id\": 53,\n                    \"name\": \"bbb\",\n                    \"examplefk\": 52\n                }\n            ],\n            \"manyonerelationfk\": 52,\n            \"manyToManyRelations\": [\n                {\n                    \"id\": 52,\n                    \"name\": \"aaaaa\"\n                },\n                {\n                    \"id\": 53,\n                    \"name\": \"bbbbb\"\n                }\n            ]\n        }\n    },\n    {\n        \"id\": 53,\n        \"name\": \"bbbb\",\n        \"example\": {\n            \"id\": 53,\n            \"name\": \"bb\",\n            \"oneToOneRelation\": {\n                \"id\": 53,\n                \"name\": \"b\"\n            },\n            \"oneToManyRelations\": [\n                {\n                    \"id\": 54,\n                    \"name\": \"ccc\",\n                    \"examplefk\": 53\n                },\n                {\n                    \"id\": 55,\n                    \"name\": \"ddd\",\n                    \"examplefk\": 53\n                }\n            ],\n            \"manyonerelationfk\": 53,\n            \"manyToManyRelations\": []\n        }\n    },\n    {\n        \"id\": 54,\n        \"name\": \"cccc\",\n        \"example\": {\n            \"id\": 54,\n            \"name\": \"cc\",\n            \"oneToOneRelation\": {\n                \"id\": 54,\n                \"name\": \"c\"\n            },\n            \"oneToManyRelations\": [\n                {\n                    \"id\": 56,\n                    \"name\": \"aaa\",\n                    \"examplefk\": 54\n                },\n                {\n                    \"id\": 57,\n                    \"name\": \"bbb\",\n                    \"examplefk\": 54\n                }\n            ],\n            \"manyonerelationfk\": 54,\n            \"manyToManyRelations\": []\n        }\n    },\n    {\n        \"id\": 55,\n        \"name\": \"dddd\",\n        \"example\": {\n            \"id\": 55,\n            \"name\": \"dd\",\n            \"oneToOneRelation\": {\n                \"id\": 55,\n                \"name\": \"d\"\n            },\n            \"oneToManyRelations\": [\n                {\n                    \"id\": 58,\n                    \"name\": \"ccc\",\n                    \"examplefk\": 55\n                },\n                {\n                    \"id\": 59,\n                    \"name\": \"ddd\",\n                    \"examplefk\": 55\n                }\n            ],\n            \"manyonerelationfk\": 55,\n            \"manyToManyRelations\": []\n        }\n    }\n]\n```\n\n## Resources and Links\n\n1. https://www.codejava.net/frameworks/spring-boot/connect-to-postgresql-database-examples\n2. https://www.baeldung.com/spring-boot-security-autoconfiguration\n3. https://www.baeldung.com/spring-postconstruct-predestroy\n4. https://dev.to/jhonifaber/hibernate-onetoone-onetomany-manytoone-and-manytomany-8ba\n5. https://stackoverflow.com/questions/56424524/getting-infinite-json-response-when-using-many-to-one-mapping-in-spring\n6. https://www.baeldung.com/jackson-bidirectional-relationships-and-infinite-recursion\n7. https://www.baeldung.com/hibernate-one-to-many\n8. https://www.baeldung.com/spring-boot-hikari\n9. https://docs.spring.io/spring-boot/reference/io/caching.html#io.caching.provider.simple\n10. https://medium.com/@avi.singh.iit01/optimizing-performance-with-spring-data-jpa-85583362cf3a\n11. https://thorben-janssen.com/hibernate-performance-tuning/\n12. https://www.danvega.dev/blog/jdk-24-virtual-threads-without-pinning","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoughtscript%2Fjava_spring_boot_2024","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthoughtscript%2Fjava_spring_boot_2024","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoughtscript%2Fjava_spring_boot_2024/lists"}