Jul 14th, 2010, 07:40 AM
how to initialize a bean with the current class loader?
I'm configuring spring to generate a bean (each time different) that should accept a parameter in the constructor that is the class loader of the entity that requires the bean. At least the class loader of the beanfactory should suffice. However I've no idea on how to do this, any suggestion?
Jul 14th, 2010, 11:15 AM
I can't imagine why you would want this, but I suppose if your constructor takes an "ApplicationContext" parameter, and is autowired, that would do it. You could also have it "implements ApplicationContextAware", but that wouldn't give it to you in the constructor.
Obviously, once you have the ApplicationContext, you can do "context.getClass().getClassLoader()".