- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是在网络应用程序的上下文中。我的 Impl 类有 JAX-WS
注释,而 @Autowired
注释不起作用。我在检索 Autowired 对象时遇到空指针异常。
找到解决方案,两者都有效:
SpringBeanAutowiringSupport
并保持 @Autowired
注释完整。WebApplicationContextUtils
获取加载bean 的WebapplicationContext
。此上下文中的 getBean() 为我提供了所需的 bean。现在,SpringBeanAutowiringSupport
类的文档在 NOTE 中说"如果有访问 ServletContext 的显式方法,则首选这种方式而不是使用此类。WebApplicationContextUtils 类允许轻松访问基于 ServletContext 的 Spring 根 Web 应用程序上下文。"
这是什么意思?在我的 Web 应用程序中,我没有使用任何 servlet。我的 Web 应用程序也不是唯一的 JAX-WS
应用程序。它是一个带有 SOAP/REST webservices
和 EJB
的 web 应用程序。
首选哪种方法,为什么?请帮忙。
最佳答案
在 spring 文档中提到扩展 SpringBeanAutoWiringSupport 作为首选方式。这种方法不是更好吗,因为您不必从 webcontext 显式访问 bean?
关于SpringBeanAutowiringSupport 与 WebApplicationContextUtils,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30863056/
这是在网络应用程序的上下文中。我的 Impl 类有 JAX-WS 注释,而 @Autowired 注释不起作用。我在检索 Autowired 对象时遇到空指针异常。 找到解决方案,两者都有效: 扩展
我对上述类有一些集成问题,但仅限于“太新”的 tomcat 版本。 基础设置: web.xml FooService jax-ws com.sun
虽然在我的@Webservice 类中我扩展了 SpringBeanAutowiringSupport, Autowiring 根本不适用于 Spring 2.5,tomcat6. 没有注入(inje
我编写了一个包含 Autowiring 服务的自定义 JsonDeserializer,如下所示: public class PersonDeserializer extends JsonDeseri
我正在尝试在我的 web 服务中启用 Spring Autowiring 支持,遵循 public class MyService extends SpringBeanAutowiringSuppor
我通过扩展 SpringBeanAutowiringSupport 暴露的 Web 服务未能注入(inject) @Autowired 依赖项。 Web 服务部署良好,我可以调用 @WebMethod
我是一名优秀的程序员,十分优秀!