Ability to disable some beans in the Spring Boot auto configuration? #1840
aukevanleeuwen
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
The |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Looking at the Spring Boot autoconfiguration it's not all that easy to remove some of the default filters. As an example:
bodyFilters
has an explicit property to disable:logbook/logbook-spring-boot-autoconfigure/src/main/java/org/zalando/logbook/autoconfigure/LogbookAutoConfiguration.java
Lines 249 to 256 in fde0074
and
pathFilter
defaults tonone()
:logbook/logbook-spring-boot-autoconfigure/src/main/java/org/zalando/logbook/autoconfigure/LogbookAutoConfiguration.java
Lines 236 to 248 in fde0074
but the potentially expensive JSON parsing cannot be easily disabled, because it's conditional on a
JacksonJsonFieldBodyFilter
:logbook/logbook-spring-boot-autoconfigure/src/main/java/org/zalando/logbook/autoconfigure/LogbookAutoConfiguration.java
Lines 257 to 266 in fde0074
You can specify a bean with exactly the same name
jsonBodyFieldsFilter
, but this requires you to setspring.main.allow-bean-definition-overriding=true
, which ideally I don't want to do and is quite brittle as well. Or do something like:which is also not very nice. Maybe adding properties to them like the body filter has makes sense?
Beta Was this translation helpful? Give feedback.
All reactions