在现有的Spring项目中添加AWS Maven依赖项后,我遇到了如下所述的问题。如果删除下面的依赖关系,一切正常,但是实际上我想在现有项目中创建一个lambda函数。
<dependency>
<groupId>com.amazonaws.serverless</groupId>
<artifactId>aws-serverless-java-container-spring</artifactId>
<version>0.9</version>
</dependency>
tomcat启动时显示以下错误:
SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Error during ServletContainerInitializer processing
javax.servlet.ServletException: Failed to instantiate WebApplicationInitializer class
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:158)
Caused by: java.lang.NoSuchMethodException: com.amazonaws.serverless.proxy.spring.LambdaSpringApplicationInitializer.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.getDeclaredConstructor(Class.java:2178)
at org.springframework.util.ReflectionUtils.accessibleConstructor(ReflectionUtils.java:503)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:155)
请让我知道我做错了什么。