Spring get current ApplicationContext

后端 未结 11 944
陌清茗
陌清茗 2020-11-28 20:04

I am using Spring MVC for my web application. My beans are written in \"spring-servlet.xml\" file

Now I have a class MyClass and i want to

11条回答
  •  天命终不由人
    2020-11-28 20:55

    Simply inject it..

    @Autowired
    private ApplicationContext appContext;
    

    or implement this interface: ApplicationContextAware

提交回复
热议问题