YouTube jhipster4博客演示:在哪里'校长'从?在接口的方法中似乎没有参数

时间:2017-03-08 05:54:55

标签: jhipster

public interface BlogRepository extends JpaRepository<Blog,Long> {

    @Query("select blog from Blog blog where blog.user.login = ?#{principal.username}")
    List<Blog> findByUserIsCurrentUser();

}

在哪里&#39;校长&#39;从?似乎没有param在接口方法中命名为principal,域字段也是如此。

1 个答案:

答案 0 :(得分:1)

它是SpEL如何为弹簧数据JPA工作的。 Spring Security在EvaluationContext中添加了一些变量。

请参阅https://spring.io/blog/2014/07/15/spel-support-in-spring-data-jpa-query-definitionshttps://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query.spel-expressions

相关问题