簡體   English   中英

如何在Spring Boot中注冊Alexa V2 Servlet

[英]How can I register Alexa V2 Servlet in Spring Boot

使用Alexa,我想調用運行在Google App Engine上的Spring Boot應用程序。 我可以從Alexa-Simulator發送請求,並可以記錄請求。

我按照本教程( https://medium.freecodecamp.org/implementing-an-alexa-skill-with-spring-boot-also-why-would-you-do-such-a-thing-9992c0797646 )注冊了SpeechletServlet調用我的Intent。

現在,我正在使用Alexa-SDK V2,但我不知道如何在此版本中注冊servlet。

@Configuration

公共類AlexaConfig {

@Autowired
private HandlerSpeechlet handlerSpeechlet;

@Bean
public ServletRegistrationBean registerSpeechletServlet() {

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

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

}

這是我當前對V1的配置,但是如何在V2中進行呢?

我可以按照示例github項目的說明進行修復:

https://github.com/TheSilentHorizo​​n/spring-boot-alexa

只需實現AlexaConfiguration.java類並配置application.properties

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM