【问题标题】:Spring REST repository not exposedSpring REST 存储库未公开
【发布时间】:2017-08-23 13:40:44
【问题描述】:

这很奇怪,但是当我在 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

它有效。对此有什么办法?

【问题讨论】:

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


    【解决方案1】:

    它对我来说工作得很好。做复查。默认情况下,媒体类型为application/hal+json。但是当您从 application.properties 覆盖它时,它会更改为application/json。但是其余端点工作得很好。即使有或没有检测策略,它也能正常工作。我正在使用 spring-data-rest 2.6.1

    【讨论】:

      猜你喜欢
      • 2015-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-25
      • 2015-04-10
      • 1970-01-01
      • 1970-01-01
      • 2017-04-30
      相关资源
      最近更新 更多