私はアプリでSpringフレームワーク(2.5.4)をロードタイムウィービングで使用しており、@ Configurableとして注釈が付けられたサーブレットでフィールドを自動配線しようとした場合を除いて、すべてがどこでも正常に機能します(Spring Bean、非Springエンティティ)。素敵なNullPointerExceptionが発生します...
@Configurable(dependencyCheck=true)
public class CaptchaServlet extends HttpServlet{
@Autowired
private CaptchaServiceIface captchaService;
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
// ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext());
// captchaService = (CaptchaServiceIface) ctx.getBean("captchaService");
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
Captcha c = captchaService.getCatpcha();
req.getSession().setAttribute("captchaAnswer", c.getAnswer());
resp.setContentType("image/png");
ImageIO.write(c.getImage(), "png", resp.getOutputStream());
}
}
<context:load-time-weaver/>
<context:spring-configured/>
<context:component-scan base-package="cz.flexibla2" />
私が間違って何をしているのかについての提案はありますか?
ありがとう。