我有一个带有控制器的spring-boot应用程序,它使用Pageable作为其方法之一的参数。它工作得很好。但是我想使用spring-contract-verifier来生成和执行测试。测试的基类如下所示:
public class MvcTest {
@Before
public void setup() {
RestAssuredMockMvc.standaloneSetup(new Controller());
}
}我得到的例外是:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.domain.Pageable]: Specified class is an interface
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:99)我搜索了一下,我发现我应该添加
@EnableSpringDataWebSupport添加到我的配置类中。我创建了一个类:
@Configuration
@EnableWebMvc
@EnableSpringDataWebSupport
public class WebConfig {
}但是,我不确定如何告诉契约验证器将这个类放入配置中。谢谢
发布于 2016-09-17 04:09:04
这是错误的页面:使用org.springframework.data.domain.Pageable而不是java.awt.print.Pageable。
您需要启用
@EnableSpringDataWebSupport或
<bean class="org.springframework.data.web.config.SpringDataWebConfiguration" />@查看:http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#core.web
https://stackoverflow.com/questions/39539233
复制相似问题