简体   繁体   English

原因:java.lang.IllegalStateException:不明确的映射。 不能 map 'com.sportswin.soa.spark.controller.ISparkGameUserController' 方法

[英]Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'com.sportswin.soa.spark.controller.ISparkGameUserController' method

Today when I start the spring boot project, shows error like this:今天当我启动 spring 启动项目时,显示如下错误:

2022-01-21 14:52:04.659 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webMvcRequestHandlerProvider' defined in URL [jar:file:/root/soa-spark-service-1.0.0-SNAPSHOT.jar!/BOOT-INF/lib/springfox-spring-webmvc-3.0.0.jar!/springfox/documentation/spring/web/plugins/WebMvcRequestHandlerProvider.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is 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 'com.sportswin.soa.spark.controller.ISparkGameUserController' method 
public abstract com.sportswin.soa.misc.contract.response.Response com.sportswin.soa.spark.controller.ISparkGameUserController.sparkGameUserFirstVote(com.sportswin.soa.spark.contract.request.vote.SparkGameUserVoteRequest)
to {POST /spark/game/user/vote/first}: There is already 'sparkGameUserController' bean method
public com.sportswin.soa.misc.contract.response.Response com.sportswin.soa.spark.controller.impl.SparkGameUserController.sparkGameUserFirstVote(com.sportswin.soa.spark.contract.request.vote.SparkGameUserVoteRequest) mapped.
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769) ~[spring-beans-5.1.13.RELEASE.jar!/:5.1.13.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:218) ~[spring-beans-5.1.13.RELEASE.jar!/:5.1.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1340) ~[spring-beans-5.1.13.RELEASE.jar!/:5.1.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1186) ~[spring-beans-5.1.13.RELEASE.jar!/:5.1.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.13.RELEASE.jar!/:5.1.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.13.RELEASE.jar!/:5.1.13.RELEASE]

I check the code, and did not found the Controller two method define with the same path.我检查了代码,并没有发现 Controller 两种方法定义的路径相同。 this is the rest controller method define:这是 rest controller 方法定义:

    @GetMapping("/vote/first/{gameId}")
    Response<List<SparkGameUserVoteFirstResponse>> queryFirstVoteSparkGameUser(@PathVariable(value = "gameId") Long gameId);

    @PostMapping("/vote/first")
    Response sparkGameUserFirstVote(@RequestBody  @Valid SparkGameUserVoteRequest request);

why did this happen?为什么会这样? what should I do to fix it?I feel like the controller initial twice.我应该怎么做才能解决它?我觉得 controller 初始两次。

Try running a global text searching on text "/vote/first"?尝试对文本“/vote/first”运行全局文本搜索? (Based on error msg you may have an api prefix "/spark/game/user" on this controller. Maybe somewhere else also produce the contacted api "/spark/game/user/vote/first") (根据错误消息,您可能在此 controller 上有一个 api 前缀“/spark/game/user”。也许其他地方也会产生联系的 api“/spark/game/first”)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 引起:java.lang.IllegalStateException:找到了不明确的映射。 无法映射“appController”bean 方法 - Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'appController' bean method Spring Boot模糊映射。 无法映射方法 - Spring Boot Ambiguous mapping. Cannot map method 引起:java.lang.IllegalStateException - Caused by: java.lang.IllegalStateException Spring MVC模糊映射。 无法映射 - Spring MVC Ambiguous mapping. Cannot map 引起:java.lang.IllegalStateException:包未安装? - Caused by: java.lang.IllegalStateException: package not installed? SPARK:java.lang.IllegalStateException:找不到任何构建目录 - SPARK: java.lang.IllegalStateException: Cannot find any build directories java.lang.IllegalStateException:无法执行活动的方法,原因:java.lang.NullPointerException - java.lang.IllegalStateException: Could not execute method of the activity , Caused by: java.lang.NullPointerException java.lang.RuntimeException:原因:java.lang.IllegalStateException: - java.lang.RuntimeException: Caused by: java.lang.IllegalStateException: GraphAPI com.microsoft.graph.core.ClientException 引起:java.lang.IllegalStateException - GraphAPI com.microsoft.graph.core.ClientException Caused by: java.lang.IllegalStateException java.lang.IllegalStateException:找不到方法? - java.lang.IllegalStateException: Could not find a method?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM