Spring 小白一个, 记录下自己瞎折腾的问题..........
1. 创建了一个 Maven JavaWeb 工程;
2. 写了一个 servlet 继承 HttpServlet,并且在 web.xml 中配置, 里面有一个成员变量, 用 @Autowired 注解, AppLoggert 已注入到 Spring 中;
3. 当在 WebServiceInit 的方法中直接使用 logger 时, 报空指针;
4. 后修改为才能使用:
5. 用 new 方式生成的对象, 对象类中的 @Autowired 注解对象也是 null;
6. 通过 Spring 获取,则一切正常.
7. 注解机制有待进一步学习!