【发布时间】:2017-05-11 16:30:30
【问题描述】:
我正在分析simple Spring Boot 1.5 Spring Data REST application。令我惊讶的是,Atteo Evo Inflector 是一个巨大的热点,根据JProfiler 超过一半的 CPU:
您应该可以使用Apache Bench 重现此内容:
ab2 -c 1 -n 10000 http://localhost:8080/people
存储库是:
@RepositoryRestResource(collectionResourceRel = "people", path = "people")
public interface PersonRepository
extends PagingAndSortingRepository<Person, Long> {
List<Person> findByLastName(@Param("name") String name);
}
和 (Lombok-ed) 数据:
@Data
@NoArgsConstructor
@Entity
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String firstName;
private String lastName;
@JsonSerialize(using = MyLocalDateSerializer.class)
private LocalDate birthDate;
public Person(String firstName, String lastName, String birthDate) {
this.firstName = firstName;
this.lastName = lastName;
this.birthDate = LocalDate.parse(birthDate);
}
}
当存储库静态定义 collectionResourceRel 时,为什么 Spring HATEOAS 试图影响 @RepositoryRestResource 存储库?任何想法正确的注释是什么来配置我的 Spring Data REST 应用程序以避免运行时变形开销?
【问题讨论】:
标签: java spring-data-rest spring-hateoas