How to disable RepositoryRestHandlerMapping and EndpointHandlerMapping?

后端 未结 4 2200
轮回少年
轮回少年 2021-02-07 02:32

I am currently building an application with a REST interface, using Spring Boot, Hibernate and Spring-HATEOAS. My data model is defined as beans with @Entity annota

4条回答
  •  别跟我提以往
    2021-02-07 02:41

    Kotlin

    • Exclude Specific resource: To exclude only a specific Repository use the code below in the specific interface, the mapping in the Controller will still work.

      @Repository
      @RestResource(exported = false)
      interface SongRepository : JpaRepository
      
    • Entirely: To exclude entirely, use the Kotlin version of the previous answers in the main class:

       @SpringBootApplication
       @EnableAutoConfiguration(exclude = arrayOf(RepositoryRestMvcAutoConfiguration::class))
       class WebserviceApplication
      

提交回复
热议问题