控制臺報錯:
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.
解決辦法:
經(jīng)排查,是由于pom.xml文件中,spring-webmvc版本沖突導(dǎo)致的。