我的Spring组件

时间:2016-01-23 12:49:47

标签: java spring

我有一些带有一些简单映射的AbstractComponent。然后我有ManagerBean,它是spring bean,我需要AbstractComponent.myMap,但它是null ...

AbstractComponent

public class AbstractComponent {
   public static Map<TypeA, SomeFunctionAPI> myMap = new HashMap<>();
      static {
        myMap.put(TypeA.X, new SomeFunctionAPI(){}); //anonymous implementation depending on TypeA
        myMap.put(TypeA.F, new SomeFunctionAPI(){});
     }

ManagerBean

public ManagerBean {
    public void dosomething(){
        AbstractComponent.myMap; //myMap is null
    }

弹簧

<bean id="managerBean" class="myPckage.ManagerBean"> 

0 个答案:

没有答案