Search in sources :

Example 1 with PageableHandlerMethodArgumentResolver

use of org.springframework.data.web.PageableHandlerMethodArgumentResolver in project spring-boot by spring-projects.

the class SpringDataWebAutoConfigurationTests method webSupportIsAutoConfiguredInWebApplicationContexts.

@Test
public void webSupportIsAutoConfiguredInWebApplicationContexts() {
    this.context = new AnnotationConfigWebApplicationContext();
    ((AnnotationConfigWebApplicationContext) this.context).register(SpringDataWebAutoConfiguration.class);
    this.context.refresh();
    ((AnnotationConfigWebApplicationContext) this.context).setServletContext(new MockServletContext());
    Map<String, PageableHandlerMethodArgumentResolver> beans = this.context.getBeansOfType(PageableHandlerMethodArgumentResolver.class);
    assertThat(beans).hasSize(1);
}
Also used : PageableHandlerMethodArgumentResolver(org.springframework.data.web.PageableHandlerMethodArgumentResolver) AnnotationConfigWebApplicationContext(org.springframework.web.context.support.AnnotationConfigWebApplicationContext) MockServletContext(org.springframework.mock.web.MockServletContext) Test(org.junit.Test)

Example 2 with PageableHandlerMethodArgumentResolver

use of org.springframework.data.web.PageableHandlerMethodArgumentResolver in project spring-boot by spring-projects.

the class SpringDataWebAutoConfigurationTests method autoConfigurationBacksOffInNonWebApplicationContexts.

@Test
public void autoConfigurationBacksOffInNonWebApplicationContexts() {
    this.context = new AnnotationConfigApplicationContext();
    ((AnnotationConfigApplicationContext) this.context).register(SpringDataWebAutoConfiguration.class);
    this.context.refresh();
    Map<String, PageableHandlerMethodArgumentResolver> beans = this.context.getBeansOfType(PageableHandlerMethodArgumentResolver.class);
    assertThat(beans).isEmpty();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) PageableHandlerMethodArgumentResolver(org.springframework.data.web.PageableHandlerMethodArgumentResolver) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 PageableHandlerMethodArgumentResolver (org.springframework.data.web.PageableHandlerMethodArgumentResolver)2 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1 MockServletContext (org.springframework.mock.web.MockServletContext)1 AnnotationConfigWebApplicationContext (org.springframework.web.context.support.AnnotationConfigWebApplicationContext)1