springboot启动报错,Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
报错:
error starting applicationcontext. to display the conditions report re-run your application with 'debug' enabled.
2019-06-18 08:39:28.643 error 23200 --- [ main] o.s.boot.springapplication : application run failed
org.springframework.beans.factory.beancreationexception: error creating bean with name 'requestmappinghandlermapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/webmvcautoconfiguration$enablewebmvcconfiguration.class]: invocation of init method failed; nested exception is java.lang.illegalstateexception: ambiguous mapping. cannot map 'usercontorller' method
public java.lang.string com.yisizhu.yisizhusystem.contorller.usercontorller.unfreezeuserbyid(java.lang.string)
to { /user/freezeuserbyid}: there is already 'usercontorller' bean method
public java.lang.string com.yisizhu.yisizhusystem.contorller.usercontorller.freezeuserbyid(java.lang.string) mapped.
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1778) ~[spring-beans-5.1.7.release.jar:5.1.7.release]
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:593) ~[spring-beans-5.1.7.release.jar:5.1.7.release]
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:515) ~[spring-beans-5.1.7.release.jar:5.1.7.release]
at org.springframework.beans.factory.support.abstractbeanfactory.lambda$dogetbean$0(abstractbeanfactory.java:320) ~[spring-beans-5.1.7.release.jar:5.1.7.release]
at org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:222) ~[spring-beans-5.1.7.release.jar:5.1.7.release]
at org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:318) ~[spring-beans-5.1.7.release.jar:5.1.7.release]
at org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:199) ~[spring-beans-5.1.7.release.jar:5.1.7.release]
at org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:843) ~[spring-beans-5.1.7.release.jar:5.1.7.release]
at org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:877) ~[spring-context-5.1.7.release.jar:5.1.7.release]
at org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:549) ~[spring-context-5.1.7.release.jar:5.1.7.release]
at org.springframework.boot.web.servlet.context.servletwebserverapplicationcontext.refresh(servletwebserverapplicationcontext.java:142) ~[spring-boot-2.1.5.release.jar:2.1.5.release]
at org.springframework.boot.springapplication.refresh(springapplication.java:775) [spring-boot-2.1.5.release.jar:2.1.5.release]
at org.springframework.boot.springapplication.refreshcontext(springapplication.java:397) [spring-boot-2.1.5.release.jar:2.1.5.release]
at org.springframework.boot.springapplication.run(springapplication.java:316) [spring-boot-2.1.5.release.jar:2.1.5.release]
at org.springframework.boot.springapplication.run(springapplication.java:1260) [spring-boot-2.1.5.release.jar:2.1.5.release]
at org.springframework.boot.springapplication.run(springapplication.java:1248) [spring-boot-2.1.5.release.jar:2.1.5.release]
at com.yisizhu.yisizhusystem.yisizhusystemapplication.main(yisizhusystemapplication.java:10) [classes/:na]
caused by: java.lang.illegalstateexception: ambiguous mapping. cannot map 'usercontorller' method
public java.lang.string com.yisizhu.yisizhusystem.contorller.usercontorller.unfreezeuserbyid(java.lang.string)
to { /user/freezeuserbyid}: there is already 'usercontorller' bean method
public java.lang.string com.yisizhu.yisizhusystem.contorller.usercontorller.freezeuserbyid(java.lang.string) mapped.
at org.springframework.web.servlet.handler.abstracthandlermethodmapping$mappingregistry.assertuniquemethodmapping(abstracthandlermethodmapping.java:618) ~[spring-webmvc-5.1.7.release.jar:5.1.7.release]
at org.springframework.web.servlet.handler.abstracthandlermethodmapping$mappingregistry.register(abstracthandlermethodmapping.java:586) ~[spring-webmvc-5.1.7.release.jar:5.1.7.release]
at org.springframework.web.servlet.handler.abstracthandlermethodmapping.registerhandlermethod(abstracthandlermethodmapping.java:312) ~[spring-webmvc-5.1.7.release.jar:5.1.7.release]
at org.springframework.web.servlet.handler.abstracthandlermethodmapping.lambda$detecthandlermethods$1(abstracthandlermethodmapping.java:282) ~[spring-webmvc-5.1.7.release.jar:5.1.7.release]
at java.util.linkedhashmap.foreach(linkedhashmap.java:684) ~[na:1.8.0_191]
at org.springframework.web.servlet.handler.abstracthandlermethodmapping.detecthandlermethods(abstracthandlermethodmapping.java:280) ~[spring-webmvc-5.1.7.release.jar:5.1.7.release]
at org.springframework.web.servlet.handler.abstracthandlermethodmapping.processcandidatebean(abstracthandlermethodmapping.java:252) ~[spring-webmvc-5.1.7.release.jar:5.1.7.release]
at org.springframework.web.servlet.handler.abstracthandlermethodmapping.inithandlermethods(abstracthandlermethodmapping.java:211) ~[spring-webmvc-5.1.7.release.jar:5.1.7.release]
at org.springframework.web.servlet.handler.abstracthandlermethodmapping.afterpropertiesset(abstracthandlermethodmapping.java:199) ~[spring-webmvc-5.1.7.release.jar:5.1.7.release]
at org.springframework.web.servlet.mvc.method.annotation.requestmappinghandlermapping.afterpropertiesset(requestmappinghandlermapping.java:164) ~[spring-webmvc-5.1.7.release.jar:5.1.7.release]
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1837) ~[spring-beans-5.1.7.release.jar:5.1.7.release]
at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1774) ~[spring-beans-5.1.7.release.jar:5.1.7.release]
... 16 common frames omitted
process finished with exit code 1
最近在研究springboot, 昨晚写到一半后保存睡觉, 今早一运行报错. 在网上搜索大多数是说配置文件问题, 或者是配置文件的位置问题. 笔者发现在自己的工程中并没有这些问题, 于是又对前一天写的内容进行了一次排查.
发现, 原来是在最后copy了一段代码, 没有改完@requestmapping("xxx")路径名重复所以报错 -_-! , 修改@requestmapping("xxx")后正常运行.
出现这么尴尬的错误还真是我粗心的错, 希望对大家有所帮助, 并引以为戒.
第一篇博文, 不太成熟还请见谅 ! ! !
推荐阅读
-
springboot错误:Error starting ApplicationContext. To display the conditions report re-run your applica
-
springboot启动报错,Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
-
Error starting ApplicationContext. To display the conditions report re-run your application with 'de
-
Error starting ApplicationContext. To display the conditions report re-run your application with 'de
-
Error starting ApplicationContext. To display the conditions report re-run your application with 'de
-
Error starting ApplicationContext. To display the conditions report re-run your application with ‘de
-
Error starting ApplicationContext. To display the conditions report re-run your application with 'de
-
springboot启动报错,Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
-
Error starting ApplicationContext. To display the conditions report re-run your application with 'de
-
Error starting ApplicationContext. To display the conditions report re-run your application with ‘de