Skip to content

Conversation

Akhilkumar31
Copy link

Problem:

  • H2-based dev/test diverges from production-like setups
  • Limited observability
  • Minimal default security headers

Solution:

  • docker-compose.yml + application-postgres.yml for one-command Postgres
  • Testcontainers for realistic, isolated integration tests
  • springdoc OpenAPI for discoverable endpoints; Micrometer Prometheus for metrics
  • Opinionated security headers (CSP/XSS/frame/referrer)

How to test:

  1. docker compose up -d db
  2. ./mvnw spring-boot:run -Dspring-boot.run.profiles=postgres
  3. ./mvnw -q test # runs unit + Testcontainers ITs

Verify:

Impact:

  • Faster onboarding
  • More reliable tests
  • Easier ops handoff
  • Safer defaults

@Akhilkumar31 Akhilkumar31 force-pushed the feat/postgres-dx-testcontainers branch 2 times, most recently from a646326 to 9705d95 Compare October 2, 2025 03:05
void findsOwnerByLastName() {
List<Owner> result = owners.findByLastName("Hopper");
Assertions.assertThat(result).hasSize(1);
Assertions.assertThat(result.get(0).getFirstName()).isEqualTo("Grace");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about assertions of other fields?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed: the test asserts id, first/last name, address, city, telephone (and pets empty). Also added a negative lookup case.

@Akhilkumar31 Akhilkumar31 force-pushed the feat/postgres-dx-testcontainers branch from f0e2b39 to ef025b2 Compare October 7, 2025 03:13
Signed-off-by: Akhil Kumar Puri <akhilkumar312001@gmail.com>
Signed-off-by: Akhil Kumar Puri <akhilkumar312001@gmail.com>
Signed-off-by: Akhil Kumar Puri <akhilkumar312001@gmail.com>
…nAPI

Signed-off-by: Akhil Kumar Puri <akhilkumar312001@gmail.com>
Signed-off-by: Akhil Kumar Puri <akhilkumar312001@gmail.com>
Signed-off-by: Akhil Kumar Puri <akhilkumar312001@gmail.com>
@Akhilkumar31 Akhilkumar31 force-pushed the feat/postgres-dx-testcontainers branch from ef025b2 to d6f4fc6 Compare October 7, 2025 03:20
@Akhilkumar31
Copy link
Author

Rebased onto latest main and kept upstream docker-compose as-is.
Integration test now asserts all seeded fields and includes a negative case.
Formatting applied; local Maven + Testcontainers run is green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants