Add Bean Programmatically to Spring Web App Context
问题 Because of a plug-in architecture, I'm trying to add a bean programmatically to my webapp. I have a Spring bean created through the @Component annotation, and i am implementing the ApplicationContextAware interface. My override function looks like this: @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { // this fails this.applicationContext = (GenericWebApplicationContext) applicationContext; } Basically, I can't figure out how to add a