【发布时间】:2016-09-16 19:56:34
【问题描述】:
我有一个带有控制器的 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)
我搜索了SO,发现我应该添加
@EnableSpringDataWebSupport
到我的配置类。我创建了一个类:
@Configuration
@EnableWebMvc
@EnableSpringDataWebSupport
public class WebConfig {
}
但是,我不确定如何告诉合同验证者将此类拉入配置。 谢谢
【问题讨论】:
-
不是您的问题的答案,但我很确定您不是要导入
java.awt.print.Pageable。 -
已更正,但问题仍然存在。