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
@Query("SELECT * FROM person WHERE id = :#{#person.id}")
Person findWithSpEL(PersonRef person);
When preparing a demo for the audience, I relized, that bean references in SPEL like that:
@Query(value = "SELECT * FROM users WHERE name = :name AND customer = #{@userProperties.customer()}")
Optional<User> findByName(@Param("name") String name);
Does not work and produce an exception:
Caused by: org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract java.util.Optional my_package.UserRepository.findByName(java.lang.String); Reason: EL1057E: No bean resolver registered in the context to resolve access to bean 'userProperties'
That is likely due to the lack of the BeanResolver in the EvaluationContext, as stated here. It seems to be fairly easy to provide the BeanFactoryResolver in here.
I can take a look at this.
The text was updated successfully, but these errors were encountered:
Our SpEL expressions deliberately do not wire the bean resolver as we provide a SPI to extend SpEL functionality. You need to register a EvaluationContextExtension that exposes contextual functionality for SpEL.
This documentation fragment comes from Commons. Feel free to submit a PR directly with some tweaked wording that Value Expressions do not support Bean Resolution but extensions must be provided through our SPI mechanism.
Currently we can use SPEL in queries, like that:
When preparing a demo for the audience, I relized, that bean references in SPEL like that:
Does not work and produce an exception:
That is likely due to the lack of the
BeanResolver
in theEvaluationContext
, as stated here. It seems to be fairly easy to provide theBeanFactoryResolver
in here.I can take a look at this.
The text was updated successfully, but these errors were encountered: