-
Nov 14th, 2007, 10:37 AM
#1
Custom scope and singleton
I have a custom scope created for a web app context. I call it 'application' scope, beans get directly stored in servletContext under their specified ID. The reason for this is because we have applications that don't use Spring that will be converted to use it and they expect to be able to get at the beans in the servletContext, so this helps with porting.
My question is, how can I have the beans specified with custom scope and get created when the app context is created (like a Singleton)?
Any suggestions?
Thanks,
Bill.
-
Nov 14th, 2007, 10:45 AM
#2
Why does it have to be an extra scope?
Wouldn't it be easier to create a BeanPostProcessor which (after creation of the bean) registers it also in the ServletContext? That way your beans still are singletons, no fiddling around with custom scopes.
Even better Spring already provides that, check out ServletContextAttributeExporter.
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