vendredi 16 septembre 2016

Pageable in controller not instantiated

I have a spring-boot app with controller that uses Pageable as an argument to one of its methods. It works fine. But I want to use spring-contract-verifier to generate and execute tests. Base class for tests looks like this:

public class MvcTest {

    @Before
    public void setup() {
        RestAssuredMockMvc.standaloneSetup(new Controller());
    }
}

The exception I'm getting is:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.awt.print.Pageable]: Specified class is an interface
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:99)

I searched SO and I found out that I should add

@EnableSpringDataWebSupport

to my configuration class. I created a class:

@Configuration
@EnableWebMvc
@EnableSpringDataWebSupport
public class WebConfig {
}

However, I'm not sure how to tell contract verifier to pull this class into configuration. Thanks

Aucun commentaire:

Enregistrer un commentaire