Spring boot 使用spring引导进行end2end web服务测试

Spring boot 使用spring引导进行end2end web服务测试,spring-boot,spring-ws,Spring Boot,Spring Ws,我使用SpringWS和SpringBoot创建了一个简单的web服务。我编译它,运行它,它就工作了。我能够访问wsdl等 然后我想我可以使用spring boot进行end2end测试,如下所示: public class TimesheetWsShould { @Before public void return0ElementsIfNoHoursWasBookedInMonth() { Main.main(new String[] {}); // this

我使用SpringWS和SpringBoot创建了一个简单的web服务。我编译它,运行它,它就工作了。我能够访问wsdl等

然后我想我可以使用spring boot进行end2end测试,如下所示:

public class TimesheetWsShould {

    @Before
    public void return0ElementsIfNoHoursWasBookedInMonth() {
        Main.main(new String[] {}); // this is where spring-boot starts
    }

    @Test
    public void actualTest(){
       //actual test using spring-ws template to consume web service.
    }
}
主类是spring boot发挥神奇作用的地方。 不幸的是,在启动过程中抛出了一个异常,它没有告诉我任何有用的信息。用谷歌搜索类似的问题并没有令人满意的结果

问题是为什么当我运行整个包时,一切都正常,但从测试中以编程方式调用它却不正常。我假设在构建过程中会进行额外的配置

下面是运行测试时收到的错误消息:


org.springframework.beans.factory.BeanCreationException:创建名为“defaultMethodEndpointAdapter”的bean时出错,该bean在类路径资源[org/springframework/ws/config/annotation/DelegatingWsConfiguration.class]:bean实例化失败;嵌套异常为org.springframework.beans.factory.BeanDefinitionStoreException:factory方法[public org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter org.springframework.ws.config.annotation.WsConfigurationSupport.DefaultMethodEndpointAdapter()]引发异常;嵌套的异常是java.lang.NoSuchMethodError:org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter.SetCustomMethodArgumentResolver(Ljava/util/List;)V

为什么不简单地在Spring引导中使用,而不是尝试(重新)发明自己的?非常感谢。看起来我做得更难:)。顺便说一句,我在配置中用额外的bean解决了我的问题,但这比在测试类中添加几个注释要麻烦得多;)