Initially we also had support for SpEL Expression parameters in query derivation but we decided to leave it out for now, since we had some concerns whether having SpEL expressions in user code is a good idea.
Configure SpEL expression as a bean
@Bean
Expression currentUserEmailAdress(){
return new SpelExpressionParser().parseExpression("principal?.emailAddress");
}
Allow Expression
s to be used as Parameters in repository query methods
List<BusinessObject> findByOwnerEmailAddress(Expression currentUserEmailAddress);
Useage example
...
@Autowired Expression currentUserEmailAdress;
...
public void someBusinessMethod(..){
List<BusinessObject> businessObjects = repository.findByOwnerEmailAddress(currentUserEmailAddress);
}
Please let us know what you think about that as well :)