Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Tapestry 项目中有一个 HttpServlet。但我认为它不被认为是 IoC 的一部分。所以当我这样做时@inject它不起作用。它最终抛出一个空指针异常。关于如何注入相同的休眠会话的任何建议。
@inject
在 servlet doPost() 方法中,我执行了以下操作。
Registry registry = (Registry) getServletContext().getAttribute(TapestryFilter.REGISTRY_CONTEXT_NAME); hbSession = registry.getService(Session.class);