Skip to content

Conversation

@peholmst
Copy link
Member

@peholmst peholmst commented Jun 10, 2025

This PR prepares the Walking Skeleton for Control Center in terms of database connectivity:

  • The application is configured to use PostgreSQL and Hibernate DDL schema generation by default
  • Integration tests use Testcontainers and require Docker
  • Running ./mvnw spring-boot:test-run starts the application using a temporary PostgreSQL database inside a Testcontainer.

The above is what you should be doing in real applications. However, they all require Docker. We don't want to require developers to have Docker installed just to start up their working skeletons. To fix this, there is a h2-local-development Maven profile that gets activated by default if no other Maven profile has been activated. This profile uses an in-memory H2 database instead of PostgreSQL. In practice, this means that:

  • Running ./mvnw spring-boot:run starts the application using H2
  • Running the unit tests do not require Docker
  • Doing the production build switches to PostgreSQL but still does not require docker (explicit production Maven profile)
  • Running the integration tests switches to PostgreSQL and require docker (explicit integration-test Maven profile)

Once you're ready to ditch H2, you only need to delete a single Maven profile from your pom.xml file.

https://github.com/vaadin/control-center/issues/958 must be fixed for the skeleton to work.

To make everything work with Control Center, this PR also includes the security changes from #66.

This PR should NOT be cherry picked to 24.7.

* directory. This method is a workaround that deduces the project folder correctly and uses a system property to
* instruct Vaadin to use it.
*/
private static void initializeProjectFolder() {
Copy link
Member Author

Choose a reason for hiding this comment

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

@mshabarov @Artur- Is this something that could be added to Flow?

Copy link
Member Author

Choose a reason for hiding this comment

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

Something like this: vaadin/flow#21683

@peholmst peholmst merged commit cb704a7 into v24.8 Jun 17, 2025
2 checks passed
@peholmst peholmst deleted the default-db-config branch June 17, 2025 11:11
@peholmst peholmst mentioned this pull request Jun 17, 2025
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.

1 participant