-
Notifications
You must be signed in to change notification settings - Fork 369
Closed as not planned
Closed as not planned
Copy link
Labels
status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply
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.
Metadata
Metadata
Assignees
Labels
status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply