简体   繁体   中英

How can I register Alexa V2 Servlet in Spring Boot

With Alexa, I want to call my Spring Boot application, which runs on a Google App Engine. I can send requests from the Alexa-Simulator and can log the request.

I followed this tutorial ( https://medium.freecodecamp.org/implementing-an-alexa-skill-with-spring-boot-also-why-would-you-do-such-a-thing-9992c0797646 ) to register the SpeechletServlet to call my Intents.

Now, Im using the Alexa-SDK V2, but I don´t know how to register the servlet in this version.

@Configuration

public class AlexaConfig {

@Autowired
private HandlerSpeechlet handlerSpeechlet;

@Bean
public ServletRegistrationBean registerSpeechletServlet() {

    SpeechletServlet speechletServlet = new SpeechletServlet();
    speechletServlet.setSpeechlet(handlerSpeechlet);

    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(speechletServlet, "/alexa");
    return servletRegistrationBean;
}

}

This is my current configuration for V1, but how can I do it in V2?

I could fix it by following the instructions of the sample github project:

https://github.com/TheSilentHorizon/spring-boot-alexa

Just implement the AlexaConfiguration.java Class and configure the application.properties

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