开发者

Is dependency injection possible for JSP beans?

This may be a long shot question..

I am working on an application that is based on JSP/Javascript only (without a Web framework!)

Is there a way to have depencency injection for JSP beans? By jsp beans I mean beans defined like this

<jsp:useBean id="cart" scope="session" class="session.Carts" />

Is there a way/library/hack to intercept the bean creation so that when "cart" is referenced for the first time, some some of injection takes place?

Can I define somewhere a "li开发者_Go百科stener" for JSP beans (like you can do for JSF beans for example)?

I am free to do anything I want in the back-end, but I cannot add a web framework in the front-end (Don't ask!)


Yes, with spring and AspectJ - using @Configurable and <context:load-time-weaver/> (read the aop section of spring docs)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜