spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.39k stars 40.51k forks source link

Provide a configuration property for configuring an external jOOQ settings file #38778

Open MelleD opened 8 months ago

MelleD commented 8 months ago

With Spring Boot you are used to setting most settings via customizer or properties.

I would like the same for jOOQ, e.g. with the batch size

https://github.com/jOOQ/jOOQ/blob/main/jOOQ/src/main/java/org/jooq/conf/Settings.java#L423C46-L423C46

The jOOQ properties should be expanded to be able to overwrite some/all default settings.

wilkinsona commented 8 months ago

Thanks for the suggestion.

Given the very large number of settings that jOOQ supports and that it already allows them to be externalised into an XML file, I'm not sure that we should offer property-based support in Spring Boot. It would be a large initial effort to support all of the properties, accounting for whether or not they're commercial-only, dealing with default values, and so on, and would then require an ongoing maintenance effort to keep them up-to-date.

An alternative option would be to add support for providing the location of a settings file and automatically using it to configure the Settings on the auto-configured Configuration. That would be similar to what we offer for Cassandra through the spring.cassandra.config property. It would, however, also overlap to some extent with what jOOQ supports through -Dorg.jooq.settings and the default of looking for jooq-settings.xml at the root of the classpath. Making use of this existing externalisation may be the best option as it doesn't add any extra complexity around which location takes precedence.

Let's see what the rest of the team thinks.

MelleD commented 8 months ago

@wilkinsona thanks for the quick answer.

That makes perfect sense.

My thoughts were: a) Start with a few properties and extend if when needed b) Build it generically like property key = setting#method c) Build a customizer that you can at least inject your own propeties and then set them manually

c) we are currently doing more or less, but its not really nice

The problem with xml is that you cannot use other properties (e.g. for reuse) or the other mechanism for overwriting via ENV or config server etc. does not work.

mhalbritter commented 7 months ago

I like the spring.jooq.config idea to point it to the settings file.

It would, however, also overlap to some extent with what jOOQ supports through -Dorg.jooq.settings and the default of looking for jooq-settings.xml at the root of the classpath.

True, but those properties and "magic locations" don't feel very Spring Boot like. I'd prefer a config property.

Build a customizer that you can at least inject your own propeties and then set them manually

I'd be open for that, too.

wilkinsona commented 7 months ago

We discussed this today and decided that we'd like to provide a configuration property for specifying an external settings.xml to use as well as a customizer to make programmatic configuration of the settings more straightforward.

ahrytsiuk commented 7 months ago

@MelleD @mhalbritter there is already a customizer for jOOQ:

org.springframework.boot.autoconfigure.jooq.DefaultConfigurationCustomizer
mhalbritter commented 7 months ago

You're right, thanks!