I'm developing OSGI application and I need to refresh my application-context.xml during runtime.
I wanted to use
String ctxPath = ....
ApplicationContext ctx = new FileSystemXmlApplicationContext(ctxPath);
((ConfigurableApplicationContext)ctx).refresh();
The problem is - I can't find a way to get path to my application-context.xml (its inside OSGI bundle). The only way I'm aware of, to get inside files of bundle, is to use
InputStream inputStream = new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream("/application-context.xml"));
But I can't get path from InputStream. Any ideas how to make this work?
ClassPathXmlApplicationContextinstead ofFileSystemXmlApplicationContext; and provide the path "/application-context.xml". - awd