简体   繁体   中英

Spring REST repository not exposed

It is strange but when I have in Spring Boot the following Spring Data Rest in config

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

and class

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

}

It is not exposed. However when I change it to any config where I leave out of the config props like

spring:
  data:
    rest:
      detection-strategy: annotated

or:

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

it works. What can be done about this ?

It is working perfectly fine for me. Do recheck. By default the mediatype is application/hal+json . But when you override it from application.properties, it is changed to application/json . But the Rest endpoints work perfectlyy fine. It is working even with or without detection-strategy. I am using spring-data-rest 2.6.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM