Tag: 春天hateoas

如何禁用RepositoryRestHandlerMapping和EndpointHandlerMapping?

我目前正在使用Spring Boot,Hibernate和Spring-HATEOAS构建一个带有REST接口的应用程序。 我的数据模型被定义为具有@Entity批注的bean,我使用Spring的特性来自动设置一个Hibernate仓库(创建一个扩展PagingAndSortingRepository的界面)。 我的应用程序完全是注解驱动的,也就是说,我没有web.xml但是使用@Configuration @Bean , @Configuration @Bean等Spring注解来配置所有的东西,并且在SpringApplication.run(MyApp.class, args);的帮助下从我的main方法启动应用程序SpringApplication.run(MyApp.class, args); 这工作正常,但通过这种方法,创建了一个RepositoryRestHandlerMapping和EndpointHandlerMapping 。 这些创造了一堆我既不需要也不想要的资源。 我实现我自己的控制器,因为他们需要做比标准的逻辑更多。 我怎样才能防止这种默认行为,并禁用这些映射?