Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.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
Java Spring异步方法不适用于终结点_Java_Spring_Web Services_Asynchronous_Spring Ws - Fatal编程技术网

Java Spring异步方法不适用于终结点

Java Spring异步方法不适用于终结点,java,spring,web-services,asynchronous,spring-ws,Java,Spring,Web Services,Asynchronous,Spring Ws,我的异步实现不起作用,尽管看起来我做的一切都是正确的 我正在从端点类调用异步方法 请看一下我下面的代码,并帮助我解决问题 我的端点类如下所示: @Endpoint public class EndpointDummy { private static final String TARGET_NAMESPACE = "http://www.abc.xyz.com/GetAcctInfo"; @Autowired private DummyService service;

我的异步实现不起作用,尽管看起来我做的一切都是正确的

我正在从端点类调用异步方法

请看一下我下面的代码,并帮助我解决问题

我的端点类如下所示:

@Endpoint
public class EndpointDummy {

    private static final String TARGET_NAMESPACE = "http://www.abc.xyz.com/GetAcctInfo";

    @Autowired
    private DummyService service;

    @PayloadRoot(localPart = "GetAcctInfoRq", namespace = TARGET_NAMESPACE)
    public @ResponsePayload GetAcctInfoRs handleRequest(@RequestPayload GetAcctInfoRq request, MessageContext messageContext) throws JAXBException, TransformerException {

        /*****************************************************************
        * Call the handler function
        * This handler function is asynchronous
        *****************************************************************/
        service.handleRequest();

        /*****************************************************************
        * Send response back
        *****************************************************************/
        SaajSoapMessage soapResponse = (SaajSoapMessage) messageContext.getResponse();
        SoapHeader respheader = soapResponse.getSoapHeader(); 

        MsgHdrRs msgHdrRs = new MsgHdrRs();
        JAXBContext jaxbContext = JAXBContext.newInstance(MsgHdrRs.class);
        jaxbContext.createMarshaller().marshal(msgHdrRs, respheader.getResult());

        GetAcctInfoRs response = new GetAcctInfoRs();
        return response;
    }
}
如上所示,我的端点类调用DummyService方法HandlerRequest

虚拟服务类用@Service注释,方法handRequest用@Async注释,如下所示:

@Service
public class DummyService {

    private Logger logger = Logger.getLogger(DummyService.class);

    @Async("taskExecutorServiceImpl")
    public void handleRequest() {

        logger.info("DummyService: 1");

        try {
            Thread.sleep(20000);
        } catch (InterruptedException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }

        logger.info("DummyService: 2");
    }

}
我还将我的配置类定义如下:

@Configuration
@EnableAsync
public class ThreadConfig {

    @Bean(name = "taskExecutorServiceImpl")
    public ThreadPoolTaskExecutor specificTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.initialize();
        return executor;
    }
}
请帮我解决这个问题。我是Spring框架的新手,非常感谢您在这方面的帮助


谢谢

问题已解决,与上述代码无关。 问题在配置文件中,与上面正确的代码无关