Search code examples
springdependency-injectionjsr168

spring ioc and JSR168 Portlets


Is it possible to do dependency injection using spring into a jsr168 Portlet?


Solution

  • Yes - have a look at the portlet chapter in the spring reference.

    Notice that you need to implement the special spring portlet controller interface, and not the standard portlet. These controller as well as the injected beans should be in the spring context file specified in the contextConfigLocation parameter. I guess that the usual applicationContext.xml will work as well (if you register the spring servlet context listener)