if (DynamicDeployUtil.isReload() && DynamicDeployUtil.isReloadResource(_SPRING_CONFIG_NAME)) {
try {
// ClassLoader loader = LoaderUtil.getCurrentLoaderParentLoader();
// Thread.currentThread().setContextClassLoader(loader);
XmlWebApplicationContext xmlWebApplicationContext = (XmlWebApplicationContext) ContextLoader.getCurrentWebApplicationContext();
DefaultListableBeanFactory defaultListableBeanFactory = (DefaultListableBeanFactory) xmlWebApplicationContext.getBeanFactory();
Properties pros = new Properties();
defaultListableBeanFactory.setBeanClassLoader(LoaderUtil.getClassLoader());
pros.load(new ByteArrayInputStream(DynamicDeployUtil.findResource(_SPRING_CONFIG_NAME)));
for (String key : pros.stringPropertyNames()) {
BeanDefinition beanDefinition = defaultListableBeanFactory.getBeanDefinition(key);
beanDefinition.setBeanClassName(pros.getProperty(key));
defaultListableBeanFactory.registerBeanDefinition(key, beanDefinition);
}
} catch (IOException ex) {
Logger.getLogger(SpringDynamicBeanLoader.class.getName()).log(Level.SEVERE, null, ex);
}
}