Spring Boot启动报错Error creating bean with name 'endpointHandlerMapping' defined in class path resource

控制台报错:


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'endpointHandlerMapping' defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcManagementContextConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint@73839f22' bean method

public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()

to {[/metrics || /metrics.json],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint@73839f22' bean method

public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)    mapped.

解决办法:

经排查,是由于pom.xml文件中,spring-webmvc版本冲突导致的。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容