[英]Simple Spring REST service doesn't work
我正在尝试使用Spring Boot创建一个简单的MongoDB REST服务,但是我一生都无法弄清为什么它是如此难以启动。 我在运行时使用Gradle编译了这些依赖项
compile('org.mongodb:bson:3.3.0')
compile 'org.mongodb:mongodb-driver:3.3.0'
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
compile('springframework:spring-web:1.2.6')
而且该应用程序正在退出,并带有一些神秘的消息:
Closing org.springframework.context.annotation.AnnotationConfigApplicationContext
所以然后我尝试添加更多的依赖项,看看是否有帮助...上帝,我有依赖项:
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-tomcat")
这导致了更加神秘的消息:
java.lang.NoSuchMethodError: org.springframework.web.context.support.ServletContextAwareProcessor: method <init>()V not found
我觉得启动这样一个简单的服务的过程是不必要的复杂...我已经用Express,Revel和Django非常简单地完成了这个工作,但是Spring Boot似乎并不容易。 我对这个过程缺少什么?
谢谢!
去掉
compile('springframework:spring-web:1.2.6')
从您的Gradle文件中。 这件神器已有很长的历史了。 Spring Boot依赖项引入了所有必需的Spring依赖项,因此通常不必指定Spring依赖项本身。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.