Spring bean注解后取对象

来源:互联网 发布:淘宝上哪家西服定做好 编辑:程序博客网 时间:2024/05/22 11:51

1、被注解的类        

@Autowired
    private TfaAlarmDao tfaAlarmDao;

2、取注解类

ApplicationContext app = new FileSystemXmlApplicationContext("classpath:appContext-service-mockalarm.xml");

        tfaAlarmDao = (TfaAlarmDao)app.getBean("tfaAlarmDao");
0 0
原创粉丝点击