Spring REST存储库未公开

时间:2017-03-29 21:05:32

标签: java spring spring-boot spring-data spring-data-rest

这很奇怪,但是当我在 Spring Boot 中有以下 Spring Data Rest 时,配置

spring:
  data:
    rest:
      default-media-type: application/json
      detection-strategy: annotated

和班级

@RepositoryRestResource
public interface RestRestaurantRepo extends CrudRepository<Restaurant, Long> {

}

没有曝光。但是,当我将其更改为任何配置,我将其从配置道具中删除,如

spring:
  data:
    rest:
      detection-strategy: annotated

或:

spring:
  data:
    rest:
      default-media-type: application/json

它有效。可以做些什么呢?

1 个答案:

答案 0 :(得分:0)

它对我来说非常好。重新检查。默认情况下,mediatype是application/hal+json。但是当您从application.properties覆盖它时,它将更改为application/json。但是Rest端点的工作非常好。即使有或没有检测策略,它仍在工作。我正在使用spring-data-rest 2.6.1