DATAJDBC-397 - Experimental support for SpEL inside @Query annotations.
This PR tries to add experimental support to Spring Data JDBC. I've been able to use this PR with Spring Security, As described in https://spring.io/blog/2014/07/15/spel-support-in-spring-data-jpa-query-definitions you can now use something like
interface PersonRepository extends PagingAndSortingRepository<Person, String> {
@Query("SELECT * FROM person WHERE username = :#{ principal?.username }")
Person findActiveUser();
}
Some things I like to discuss, because I don't want to do any stupid things here:
- As I've already mentioned to @schauder on Twitter, this is a working prototype. I am pretty sure that there are too many corner cases I haven't think of or parts I am still lacking the understanding of :-(
- Please let me know if I am misinterpreting the Contribution guidelines regarding the JavaDoc @author tag; I don't want to take credit for something I haven't contributed for.
-
ParameterBindingsandParameterBindingParsercome from the Spring Data JPA project. At the moment they are both copy&pasted from SD-JPA and have public access modifiers. Both classes should probably be moved to Spring Data Commons.
Thank you for taking the time to look into this PR!
Would really like to see SpEL support on Query-annotation here. Can this PR be finalized as is ?
I rebased this, applied Marks comments and merged it with main. Thanks for this PR.
@schauder This change is in which version? 3.0.1?
@peteraramaldes This went into 3.0.0-RC1. It is therefore part of all 3.x releases after that including the 3.0.0 GA release.