0

Xtend 和 Spring Data 之间的命名约定似乎不兼容。

例如:

// User.xtend
class User {
    @Property
    var Long id;
 }

 interface UserRepository extends JpaRepository<User> {
     public User findById(Long id)
 }

@Property注释重命名id为,_id导致 Spring Data 失败,声称No property id found

有没有办法:

  • 禁止 Xtend 重命名字段
  • “教”有关命名约定的 Spring Data(寻找字段?添加下划线)
  • 指示 Spring Data 使用属性访问,而不是属性解析的字段访问?

我相信任何这些都可以解决这个问题。

4

1 回答 1

1

从 2.7.3 开始,@Property 注释已被 @Accessors 取代,它不再在字段前加下划线。

在 2.7.3 之前,您必须构建自己的 @Property 注释,该注释不会在字段名称前加上下划线。

http://www.eclipse.org/xtend/documentation.html#activeAnnotations

(更新)

于 2013-08-09T10:52:11.513 回答