Closed as not planned
Description
Currently we can use SPEL in queries, like that:
@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.