So, let's consider a general Spring boot
application, which uses JOOQ
for database database access, and Flyway
for database migration. The project uses gradle
for dependency management.
I want the following things:
- Run my application in docker. So, I want to use only in environment variables (https://12factor.net/config). Hence, I don't know, how to configure both spring boot application properties (database login and password) and gradle JOOQ plugin database login and password.
- Automatic generation JOOQ classes. Flyway migration runs, when an application has started. But JOOQ generates code in
gradle build
task. So, we see wrong order of tasks execution.
I have a very similar setup, but resorted to manual action to generate Jooq classes. I need them for development, so it makes no sense for me to delay the generation till target environment.
I decided to run a local dB for development purposes. I run it in docker, but this is a detail in the entire setup.
When I have a new migration, I run it with flyway grade plugin against the local dB. Then I regenerate Jooq classes with grade Jooq plugin.
When the app is deployed in the target environment, I rely on flyway to run migration on startup. I have matching Jooq classes packaged, so everything works smoothly.