Ranging from Spring Boot 2.5, there’s a useful new callback that you would be able to implement, known as DefaultConfigurationCustomizer
, the place the phrase DefaultConfiguration corresponds to jOOQ’s DefaultConfiguration
. You’ll be able to merely create a category like this in your undertaking:
import org.jooq.conf.RenderQuotedNames;
import org.jooq.impl.DefaultConfiguration;
import org.springframework.boot.autoconfigure.jooq.*;
import org.springframework.context.annotation.*;
@Configuration
public class Config {
@Bean
public DefaultConfigurationCustomizer configurationCustomiser() {
return (DefaultConfiguration c) -> c.settings()
.withRenderQuotedNames(
RenderQuotedNames.EXPLICIT_DEFAULT_UNQUOTED
);
}
}
The above callback receives the DefaultConfiguration
at its initialisation stage, throughout which you’ll be able to nonetheless safely mutate it to vary any of the defaults, or add extra settings, and so forth. That’s it!
You’ll be able to set a breakpoint within the lambda to validate when this initialisation is invoked:
Attributable to: java.lang.RuntimeException at org.jooq.instance.spring.Config.lambda$0(Config.java:30) at org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration$DslContextConfiguration.lambda$jooqConfiguration$1(JooqAutoConfiguration.java:104) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.settle for(ForEachOps.java:183) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at java.base/java.util.stream.SortedOps$RefSortingSink.finish(SortedOps.java:395) at java.base/java.util.stream.Sink$ChainedReference.finish(Sink.java:258) at java.base/java.util.stream.Sink$ChainedReference.finish(Sink.java:258) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.base/java.util.stream.AbstractPipeline.consider(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) at org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration$DslContextConfiguration.jooqConfiguration(JooqAutoConfiguration.java:104) at java.base/jdk.inside.mirror.NativeMethodAccessorImpl.invoke0(Native Technique) at java.base/jdk.inside.mirror.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.inside.mirror.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.mirror.Technique.invoke(Technique.java:568) at org.springframework.beans.manufacturing facility.help.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ... 119 extra
To mess around with this instance, try our jOOQ-spring-boot-example on github.