Error on ConversionService for dates
Hello,
I enabled the advanced features of the library to use the operators on date(time). I’m using version 4.0.0 of querydsl-value-operators and version 2.1.5 of spring boot. But I’m getting an error with the Bean “querydslPredicateArgumentResolverBeanPostProcessor”.
For example, when I use the following code:
@Bean
public QuerydslPredicateArgumentResolverBeanPostProcessor querydslPredicateArgumentResolverBeanPostProcessor(
QuerydslBindingsFactory factory, DefaultFormattingConversionService conversionServiceDelegate) {
return new QuerydslPredicateArgumentResolverBeanPostProcessor(factory, conversionServiceDelegate);
}
I got this error:
APPLICATION FAILED TO START
Description:
Parameter 1 of method querydslPredicateArgumentResolverBeanPostProcessor in com.dogwalk.dogwalk.config.QueryDslValueOperatorsConfig required a bean of type 'org.springframework.format.support.DefaultFormattingConversionService' that could not be found.
And when I try the following code:
@Bean
public QuerydslPredicateArgumentResolverBeanPostProcessor querydslPredicateArgumentResolverBeanPostProcessor(
QuerydslBindingsFactory factory, @Qualifier("defaultConversionService") ConversionService conversionService) {
return new QuerydslPredicateArgumentResolverBeanPostProcessor(factory, conversionService,
new Class[]{Date.class, LocalDate.class, Timestamp.class, Boolean.class, boolean.class});
}
I got this error:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'querydslPredicateArgumentResolverBeanPostProcessor' defined in class path resource [com/dogwalk/dogwalk/config/QueryDslValueOperatorsConfig.class]: Unsatisfied dependency expressed through method 'querydslPredicateArgumentResolverBeanPostProcessor' parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.core.convert.ConversionService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=defaultConversionService)}
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.core.convert.ConversionService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=defaultConversionService)}
Any idea about how could this be solved?
I don't know much about this conversion thing. I also know maybe this isn't a bug, but this is a very good library and I would like to understand it better ...
I would really appreciate if someone could help me on this.
thanks!
Comments (2)
-
reporter -
repo owner - changed status to open
I will take a look soon
- Log in to comment
UPDATES:
I implemented the following bean:
And commented the date attribute (dtDespesa) in the customize method, just like this:
Now the filter is working but I got the following error if I try to use lt or gt functions in the URL, example: dtDespesa=lt(20200506)
All these annotations are used by the var dtDespesa in the Entity class.
And if I remove the comment of the binding in the customize method I get the same error above.
Am I missing something?