Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有spring自动连线的RemoteServiceServlet提供nullpointerexception_Spring_Gwt_Aspectj_Spring Aop - Fatal编程技术网

带有spring自动连线的RemoteServiceServlet提供nullpointerexception

带有spring自动连线的RemoteServiceServlet提供nullpointerexception,spring,gwt,aspectj,spring-aop,Spring,Gwt,Aspectj,Spring Aop,我将GWT与Spring一起使用。我遇到了在RemoteServiceServlet中使用@Autowiredbean的问题。由于某些原因,这不能自动工作,我需要使用@Configurable使其工作。我遵循了这一点,但对于@Autowiredbean,我仍然得到了NullPointerException: @Configurable @Transactional(propagation = Propagation.REQUIRED, readOnly = false) public class

我将GWT与Spring一起使用。我遇到了在
RemoteServiceServlet
中使用
@Autowired
bean的问题。由于某些原因,这不能自动工作,我需要使用
@Configurable
使其工作。我遵循了这一点,但对于
@Autowired
bean,我仍然得到了
NullPointerException

@Configurable
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public class AServiceImpl extends RemoteServiceServlet implements AService {

    @Autowired
    private IABean aBean;

    @Override
    public void aMethodFromAService(Args arg[]) {
        aBean.aMethodOfABean(); // this gives a NullPointerException
    }
}

@Component
public class ABean implements IABean {
    ...
}
对正在发生的事情有什么指导吗?我需要提供任何额外的信息吗?


感谢Alexander为我指明了正确的方向

您找到了一个可行的解决方案,但仅供记录在案,我们的工作如下:

public class MyServiceImpl extends RemoteServiceServlet 
                           implements MyService, ServletContextAware
{
    @Autowired private transient SomeService someService;
    ....
}


SomeService
是一个完全普通的XML定义bean。也许这或
…实现ServletContextAware
会有所不同


干杯,

春天你在哪里/如何申报你的生日?XML还是注释?注释,编辑原始postdo为了使ABean成为注射的候选对象,您在应用程序上下文文件中有哪些内容。是的,我之前使用了几个@autowired并成功。是带有GWT的RemoteServiceServlet导致了一些问题。但是请注意,您应该在此网站上发布答案的有用要点,否则您的帖子可能会被删除。如果您愿意,您仍然可以包含该链接,但仅作为“参考”。答案应该是独立的,不需要链接。
<context:annotation-config/>
<context:component-scan base-package="..."/>