I have a Controller class annotated with @RestController
containing @ReguestMapping
annotations on the class' methods to identify the endpoints.
I need to add a SpeechletServlet
(part of the Alexa-skill-kit) to receive requests at an endpoint /zebra-tape
at the same time that the other endpoints are still available.
Using the code below I loose access to the endpoints annotated with @RequestMapping
public class Application extends SpringBootServletInitializer {
@Bean
public ServletRegistrationBean dispatcherServletRegistration() {
ServletRegistrationBean registration = new ServletRegistrationBean(new ZebraTapeServlet());
registration.addUrlMappings("/zebra-tape");
return registration;
}
}
How can I have access to both types of endpoints?
Rename your bean method to something other than dispatcherServletRegistration
. That name is used by Spring Boot for the registration bean for the auto-configured dispatcher servlet. By declaring a bean method with the same name, you are switching that auto-configuration off.