Spring session-scoped beans (controllers) and references to services, in terms of serialization

前端 未结 6 1143
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-27 12:44
  • a standard case - you have a controller (@Controller) with @Scope(\"session\").
  • classes put in the session usually are expected to i
6条回答
  •  感情败类
    2020-11-27 12:46

    After trying all the different alternatives suggested all I had to do was add aop:scoped-proxy to my bean definition and it started working.

    
        
        
    
    

    securityService is injected into my managedbean which is view scoped. This seems to work fine. According to spring documentation this is supposed to throw a BeanCreationException since securityService is a singleton. However this does not seems to happen and it works fine. Not sure whether this is a bug or what the side effects would be.

提交回复
热议问题