开发者

Wicket's @SpringBean's and request scoped objects

开发者 https://www.devze.com 2022-12-16 05:24 出处:网络
Is there any reason why a request scoped开发者_如何学Go Spring object would be cached between requests, by a injected @SpringBean field?The Spring bean shouldn\'t be, no, but Wicket doesn\'t inject th

Is there any reason why a request scoped开发者_如何学Go Spring object would be cached between requests, by a injected @SpringBean field?


The Spring bean shouldn't be, no, but Wicket doesn't inject the Spring bean directly into the wicket component, it generates a serializable proxy for the target spring bean definition, and injects that into your component. That proxy may be cached, dependening on your wicket component, but the target spring bean is still managed by Spring itself, and request scoped beans should remain so.

Without any more information as to why you're asking the question, I can't be much more help than that, other than to suggest you turn on DEBUG-level logging for Spring, and watch the request-scoped bean being created.


I believe you need to use the targetClass scoped-proxy type for it to work, and don't forget the:

<listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
0

精彩评论

暂无评论...
验证码 换一张
取 消