0
我嘗試使用fasterXML傑克遜這樣注入的ObjectMapper:WELD-001408:類型ObjectMapper不滿意的依賴與預選賽@default在
@Inject
private ObjectMapper objectMapper;
,但我有一個錯誤,當我嘗試部署war文件:
org.jboss.weld.exceptions.DeploymentException:WELD-001408: 預約等待依賴關係ObjectMapper類型與限定符 @default
這是我的依賴關係:
<!-- the core, which includes Streaming API, shared low-level abstractions (but NOT data-binding) -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson-2-version}</version>
</dependency>
<!-- Just the annotations; use this dependency if you want to attach annotations
to classes without connecting them to the code. -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson-2-version}</version>
</dependency>
<!-- databinding; ObjectMapper, JsonNode and related classes are here -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-2-version}</version>
</dependency>
<!-- jackson-dataformat-yaml: Support for reading and writing YAML-encoded data via Jackson abstractions -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson-2-version}</version>
</dependency>
我做錯了什麼?
ObjectMapper'可注入嗎?我不認爲它是用任何合格的CDI註釋註釋的。 –
在這種情況下,有必要創建一個提供者方法? –
說實話,我不知道這個案例,因爲我不知道這個庫的所有功能,但是當我查看ObjectMapper的源代碼時,它沒有任何合格的CDI註釋。 –