我有如下的Spring bean:
@Service("bookService")
public class BookServiceImpl implements BookService {
@Autowired
@Qualifier("bookDao")
private BookDao bookDao;
我有一个 portlet 尝试访问它,如下所示:
62 public BookService getBookService() {
63 ApplicationContext springCtx = PortletApplicationContextUtils.getWebApplicationContext(getPortletContext());
64 return (BookService)springCtx.getBean("bookService");
}
but i have the below nullpointer exception:
java.lang.NullPointerException
at chapter09.code.listing.base.BookCatalogPortlet.getBookService(BookCatalogPortlet.java:64)
at chapter09.code.listing.base.BookCatalogPortlet.init(BookCatalogPortlet.java:59)
如果我遗漏了一些可用的资源@http://portletsinaction.googlecode.com/svn/trunk/ch9_BookCatalogSpringJdbc/,请告诉我
enter code here