所以,如果我正確地跟着你(很難知道肯定沒有一個代碼段),我假設你有這樣的事情......
class MyRegion<K, V> extends Region<K, V> {
...
}
則...
@Component
class MyApplicationComponent {
@Autowired
private MyRegion<?, PdxInstance> region;
}
是啊?
所以,問題是,您不能使用@Autowired注入或自動將Region引用連接到應用程序組件中。您必須使用@資源,像這樣......
@Component
class MyApplicationComponent {
@Resource(name = "myRegion")
private MyRegion<?, PdxInstance> region;
}
的原因是,春(不分版本),默認情況下,每當autowires「地圖」到一個應用程序組件試圖創建所有的映射在Spring ApplicationContext中定義的Spring bean。即bean ID/Name - > bean引用。
因此,考慮到...
<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
那麼,什麼是你的情況發生的是,根據類型(GemFire's)PdxInstance定義的Spring上下文中沒有bean。這是您的(自定義)區域中的數據。因此,當它試圖分配Spring上下文中的所有bean或自動裝配的(自定義)區域時,Sprig將其標識爲「映射」,但不能將其他類型的Bean分配給PdxInstance,並將「Generic」類型考慮在內。
因此,總之,使用@Resource自動裝載任何GemFire區域,自定義或其他。
此外,我質疑需要「擴展」GemFire地區。也許最好使用包裝(「組合」)。
希望這會有所幫助。
乾杯!
請提供相關的代碼來複制問題。 –
@Autowired實際上是在工作....但是你的PdxInstance不是一個彈簧管理bean ...你應該發佈你的spring配置文件,java類等等以獲得幫助 – Pras