You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The solution that worked for me was to create a JdbcCustomConversions bean instead like this: @Bean public JdbcCustomConversions customConversions() { return new JdbcCustomConversions(List.of(new MyCustomConverter())); }
The text was updated successfully, but these errors were encountered:
However doing so makes it depend on JDBC specific beans not available in test slices like JsonTest.
From your description it sounds as if you're setting up a configuration that doesn't match your test slice setup as you would pull in dependencies that shouldn't be declared with that configuration in the first place.
Part of the problem is also that our documentation doesn't include Spring Boot-specifics as we do not depend on Boot, rather it is the other way around.
If you want to rely on Spring Boot to bootstrap Data MongoDB, but still want to override certain aspects of the configuration, you may want to expose beans of that type. For custom conversions you may eg. choose to register a bean of type MongoCustomConversions that will be picked up the by the Boot infrastructure. To learn more about this please make sure to read the Spring Boot Reference Documentation.
In https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/#jdbc.custom-converters.configuration the suggested way of registering custom converters is to subclass AbstractJdbcConfiguration. However doing so makes it depend on JDBC specific beans not available in test slices like JsonTest.
The solution that worked for me was to create a JdbcCustomConversions bean instead like this:
@Bean public JdbcCustomConversions customConversions() { return new JdbcCustomConversions(List.of(new MyCustomConverter())); }
The text was updated successfully, but these errors were encountered: