Check if Spring Scope is active

How to check if session area is active in Spring? for example, at startup, some classes need a User object, which is the scope of the session, than I return a mock User object.

the bean in question is declared using aop: scoped-proxy. How can I check if the session area is active?

+3
source share
2 answers

the trick was to create a factory, get a proxy server with a proxy server from the factory, and run any method that requires an actual object and scope.

then catch a BeanCreationException to detect an inactive area.

0
source

spring 3, :

bean HTTP. - spring ApplicationContext.

, - spring ApplicationContext ( , XMLWebApplicationContext), beans , , spring , beans. , , .., bean, , .

, , , , - - , " ".

+1

Source: https://habr.com/ru/post/1712863/


All Articles