/** * This allows SpEL support in Spring Data JPA @Query definitions. * <p> * See https://spring.io/blog/2014/07/15/spel-support-in-spring-data-jpa-query-definitions */ @Bean EvaluationContextExtension securityExtension() { return new EvaluationContextExtensionSupport() { @Override public String getExtensionId() { return "security"; } @Override public SecurityExpressionRoot getRootObject() { return new SecurityExpressionRoot(SecurityContextHolder.getContext().getAuthentication()) { }; } }; }
/** * This allows SpEL support in Spring Data JPA @Query definitions. * * See https://spring.io/blog/2014/07/15/spel-support-in-spring-data-jpa-query-definitions */ @Bean EvaluationContextExtension securityExtension() { return new EvaluationContextExtensionSupport() { @Override public String getExtensionId() { return "security"; } @Override public SecurityExpressionRoot getRootObject() { return new SecurityExpressionRoot(SecurityContextHolder.getContext().getAuthentication()) {}; } }; }