1
我有一个Controller类,注释类型为@RestController
,其中包含@ReguestMapping
注解,该类用于标识端点的方法。在同一应用程序中使用RestController和ServletRegistrationBean的弹簧引导
我需要添加一个SpeechletServlet
(Alexa技能套件的一部分),以在端点/zebra-tape
上接收请求,同时其他端点仍可用。
使用下面的代码,我松访问端点与@RequestMapping
public class Application extends SpringBootServletInitializer {
@Bean
public ServletRegistrationBean dispatcherServletRegistration() {
ServletRegistrationBean registration = new ServletRegistrationBean(new ZebraTapeServlet());
registration.addUrlMappings("/zebra-tape");
return registration;
}
}
我怎么能有机会获得这两种类型的端点的注释?
春季文档建议下面给出的正确答案。 https://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html#howto-convert-an-existing-application-to-spring-boot –