0

我正在尝试在 MessageBodyReader 中获取 ObjectProvider。但它最终会出现 CDI 错误:“WELD-001334:带有限定符 @Default 的类型 ObjectProvider 的依赖关系不满足”。这个想法是将 ObjectProvider 从 Jersey 映射到 JPA 的 EntityGraph。代码下方:

import org.glassfish.jersey.message.filtering.spi.FilteringHelper;
import org.glassfish.jersey.message.filtering.spi.ObjectGraph;
import org.glassfish.jersey.message.filtering.spi.ObjectProvider;

@ApplicationScoped
@Provider
@Consumes(MediaType.APPLICATION_JSON)
public class ObjectGraphMessageBodyReader extends JacksonJsonProvider {

  @Inject
  private javax.inject.Provider<ObjectProvider<ObjectGraph>> provider;

我从以下位置获取代码:https ://github.com/jersey/jersey/blob/master/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/entity/filtering/FilteringMessageBodyProvider.java

4

0 回答 0