【发布时间】:2016-10-03 22:21:35
【问题描述】:
我已经实施了一个小示例项目来说明我遇到的问题。它位于此处:
https://github.com/jvillane/spring-boot-hateoas-rest
我想要做的是创建几个 @Projection 的同一实体:
@Projection(name = "S", types = User.class)
public interface UserS {
String getName();
}
@Projection(name = "M", types = User.class)
public interface UserM {
String getName();
String getDni();
}
@Projection(name = "L", types = User.class)
public interface UserL {
String getName();
String getDni();
Country getCountry();
}
并通过调用(带引号和不带引号)使用它们来获取或多或少的实体信息:
http://localhost:8080/api/users/1?projection=S
http://localhost:8080/api/users/1?projection=M
http://localhost:8080/api/users/1?projection=L
但这对响应没有影响,就像它使用默认方式显示实体信息一样。
我不知道我做错了什么。欢迎任何帮助。
【问题讨论】:
标签: java spring-boot spring-data-rest spring-hateoas