Closed charboubmustapha closed 1 month ago
It seem that problem come from the spring boot auto configure integration especially the class R2dbcDataAutoConfiguration. The bean R2dbcCustomConversions is created with an empty list ignoring custom converters .
@Bean
@ConditionalOnMissingBean
public R2dbcCustomConversions r2dbcCustomConversions() {
List<Object> converters = new ArrayList<>(this.dialect.getConverters());
converters.addAll(R2dbcCustomConversions.STORE_CONVERTERS);
return new R2dbcCustomConversions(
CustomConversions.StoreConversions.of(this.dialect.getSimpleTypeHolder(), converters),
Collections.emptyList());
}
Please provide a Minimimal Reproducable Example, preferable as a Github repository. Make sure to include the database, either as an in memory database or if that is not possible using Testcontainers.
Please provide a Minimimal Reproducable Example, preferable as a Github repository. Make sure to include the database, either as an in memory database or if that is not possible using Testcontainers.
Sorry the example was in the first comment but the formatting was wrong , here is the example using Testcontainers r2dbc.zip
Ah sorry, looks like I messed that up. Thanks for the reproducer
IllegalArgumentException: Cannot encode parameter of type com.example.r2dbc.Mode (AUTOMATIC)
comes from the driver. Did you register an EnumCodec in the driver to configure the driver what Postgres enum type to use for a specific Java enum type? The driver documentation explains how to register enum codecs. In a Spring Boot context, you can either register a driver extension so that the driver auto-detects the extension or, you can configure ConnectionFactory
yourself.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Hello Guys, I'm using enumeration of postgresql with spring data r2dbc , i followed the documentation to register the custom converter, but the save is failing with an error of : java.lang.IllegalArgumentException: Cannot encode parameter of type com.example.r2dbc.Mode (AUTOMATIC) Here is the converter
Here is the configuration class
I created an example of project with tests : r2dbc.zip
Thank you for your help