-1
上实现MDC
使用春BOM用法错误
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
现在我打算使用
<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>2.0.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
但代码这是以前的工作:
private final Map<?, ?> parentContext; // initialized in constructor
MDC.setContextMap(parentContext);
上面一行是给出错误:
The method setContextMap(Map<String,String>) in the type MDC is not applicable for the arguments (Map<capture#5-of ?,capture#6-of ?>)
请提出建议。
你仍然需要依赖。导入应该放在'dependencyManagmenet'部分。参见http://platform.spring.io/platform/另外'MDC'与'spring-webmvc'无关,它可能是一个log4j(或slf4j)类。 –
BOM依赖关系仅在“依赖管理”部分中。我加了'log4j-over-slf4j'依赖性,同样的错误。 – Raghuveer
执行'mvn dependency:tree'并检查差异。 –