解决Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘inteController‘

This error may also cause the project to fail to start. The complete error 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 'recureController' method

1. Reasons for the error :

        Duplicate method mapping appears in the controller layer

        

        You can see that the mappings of the two methods in the picture are the same. This is the problem.

The solution is also very simple. Now that you know the problem, it is also very simple to solve. You only need to modify the repeated method mapping.

2. In addition, the project cannot be started because there is usually a configuration error. Like our commonly used xml, or errors in the control layer, here are a few common reasons

1. An empty namespace path appears in the mapper.xml file (the dao layer cannot be connected)

2. There are duplicate method names in the mapper.xml file.

3. Reverse resultMap and resultType (you need to understand the difference between the two here)

 

Guess you like

Origin blog.csdn.net/wiser_CC/article/details/130594110