Announcement Announcement Module
Collapse
No announcement yet.
Custom scope and singleton Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #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.

    Comment

    Working...
    X