-
Jul 14th, 2010, 07:40 AM
#1
how to initialize a bean with the current class loader?
Hi all,
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?
Thanks.
-
Jul 14th, 2010, 11:15 AM
#2
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()".
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules