0
我已經實現了一個小示例項目來說明我遇到的問題。它位於在這裏:@Projection not working
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
但它在響應中沒有什麼區別,就像它使用默認方式顯示實體信息。
我不知道我在做什麼錯。歡迎任何幫助。