Autowiring request scoped beans into application scoped beans

前端 未结 3 880
孤独总比滥情好
孤独总比滥情好 2021-02-08 15:17

Is it possible to autowire a request scoped bean into an application scoped bean. i.e

I have a class RequestScopedBean:

class RequestScopedBean {
   ....         


        
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-08 15:50

    You have to mark your requestScopedBean as a scoped proxy also, this way Spring will inject in a proxy for requestScopedBean and in the background manage the scope appropriately.

      
        
    
    

    More here

提交回复
热议问题