Java Spring framework 4通用类依赖项autowire不工作

Java Spring framework 4通用类依赖项autowire不工作,java,spring,spring-data-gemfire,Java,Spring,Spring Data Gemfire,在Spring4中@Autowired不适用于扩展映射的区域的类 破例 找不到依赖项[map with value type com.gemstone.gemfire.pdx.PdxInstance]类型为[com.gemstone.gemfire.pdx.PdxInstance]的符合条件的bean:应至少有1个bean符合此依赖项的autowire候选项的条件。依赖项注释:{@org.springframework.beans.factory.annotation.Autowired(req

在Spring4中@Autowired不适用于扩展映射的区域的类

破例

找不到依赖项[map with value type com.gemstone.gemfire.pdx.PdxInstance]类型为[com.gemstone.gemfire.pdx.PdxInstance]的符合条件的bean:应至少有1个bean符合此依赖项的autowire候选项的条件。依赖项注释:{@org.springframework.beans.factory.annotation.Autowired(required=true)}


它可能假设有一个收集注入点。如何做一个工作。即使添加@Qualifier也会产生相同的错误。

因此,如果我正确地跟踪了您(如果没有代码片段,很难确定),我假设您有这样的错误

class MyRegion<K, V> extends Region<K, V> {
  ...
}
类MyRegion扩展了区域{
...
}
然后

@Component
class MyApplicationComponent {

  @Autowired
  private MyRegion<?, PdxInstance> region;

}
@组件
类MyApplicationComponent{
@自动连线

private MyRegion请提供相关代码以复制该问题。@Autowired实际上正在工作……但您的PdxInstance不是spring管理的bean……您应该发布spring配置文件、java类等,以便help@Resource未启用常规贴图自动连线,因此无法正常工作
@Component
class MyApplicationComponent {

  @Resource(name = "myRegion")
  private MyRegion<?, PdxInstance> region;

}
<bean id="beanOne" class="example.BeanTypeOne"/>

<bean id="beanTwo" class="example.BeanTypeTwo"/>

...

<bean id="beanN" class="example.BeanTypeN"/>
@Autowired
Map<String, Object> beans;

beans.get("beanOne"); // is object instance of BeanTypeOne
beans.get("beanTwo"); // is object instance of BeanTypeTwo
...
beans.get("beanN"); // is object instance of BeanTypeN