Package org.dellroad.stuff.vaadin7
Class VaadinApplicationScope
- java.lang.Object
-
- org.dellroad.stuff.vaadin7.VaadinApplicationScope
-
- All Implemented Interfaces:
SessionDestroyListener,Serializable,BeanFactoryPostProcessor,Scope
public class VaadinApplicationScope extends Object implements Scope, BeanFactoryPostProcessor, SessionDestroyListener
A Spring customScopefor Vaadin applications.This scopes beans to the lifetime of the
VaadinSession(formerly known as "Vaadin application"). Spring destroy-methods will be invoked when theVaadinSessionis closed.To enable this scope, simply add this bean to your application context as a singleton (it will register itself):
Then declare scoped beans normally using the scope name<!-- Enable the "vaadinApplication" custom scope --> <bean class="org.dellroad.stuff.vaadin7.VaadinApplicationScope"/>"vaadinApplication".- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringSCOPE_NAMEThe name of this scope (i.e.,"vaadinApplication").static StringVAADIN_SERVICE_SESSION_KEYKey to the currentVaadinSessioninstance.
-
Constructor Summary
Constructors Constructor Description VaadinApplicationScope()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectget(String name, ObjectFactory<?> objectFactory)StringgetConversationId()voidpostProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)voidregisterDestructionCallback(String name, Runnable callback)Objectremove(String name)ObjectresolveContextualObject(String key)voidsessionDestroy(SessionDestroyEvent event)
-
-
-
Field Detail
-
VAADIN_SERVICE_SESSION_KEY
public static final String VAADIN_SERVICE_SESSION_KEY
Key to the currentVaadinSessioninstance. For use byresolveContextualObject(java.lang.String).- See Also:
- Constant Field Values
-
SCOPE_NAME
public static final String SCOPE_NAME
The name of this scope (i.e.,"vaadinApplication").- See Also:
- Constant Field Values
-
-
Method Detail
-
postProcessBeanFactory
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
- Specified by:
postProcessBeanFactoryin interfaceBeanFactoryPostProcessor
-
sessionDestroy
public void sessionDestroy(SessionDestroyEvent event)
- Specified by:
sessionDestroyin interfaceSessionDestroyListener
-
get
public Object get(String name, ObjectFactory<?> objectFactory)
-
registerDestructionCallback
public void registerDestructionCallback(String name, Runnable callback)
- Specified by:
registerDestructionCallbackin interfaceScope
-
getConversationId
public String getConversationId()
- Specified by:
getConversationIdin interfaceScope
-
resolveContextualObject
public Object resolveContextualObject(String key)
- Specified by:
resolveContextualObjectin interfaceScope
-
-