本文整理匯總了Java中org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport類的典型用法代碼示例。如果您正苦於以下問題:Java WebMvcConfigurationSupport類的具體用法?Java WebMvcConfigurationSupport怎麽用?Java WebMvcConfigurationSupport使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
WebMvcConfigurationSupport類屬於org.springframework.web.servlet.config.annotation包,在下文中一共展示了WebMvcConfigurationSupport類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getDefaultConverters
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; //導入依賴的package包/類
private List<HttpMessageConverter<?>> getDefaultConverters() {
List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
if (ClassUtils.isPresent("org.springframework.web.servlet.config.annotation."
+ "WebMvcConfigurationSupport", null)) {
converters.addAll(new WebMvcConfigurationSupport() {
public List<HttpMessageConverter<?>> defaultMessageConverters() {
return super.getMessageConverters();
}
}.defaultMessageConverters());
}
else {
converters.addAll(new RestTemplate().getMessageConverters());
}
reorderXmlConvertersToEnd(converters);
return converters;
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:17,代碼來源:HttpMessageConverters.java
示例2: initSpringRestComponent
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; //導入依賴的package包/類
protected ServletRegistration.Dynamic initSpringRestComponent(ServletContext servletContext, AnnotationConfigWebApplicationContext rootContext,
String restContextRoot, Class<? extends WebMvcConfigurationSupport> webConfigClass) {
LOGGER.debug("Configuring Spring Web application context - {} REST", restContextRoot);
AnnotationConfigWebApplicationContext dispatcherServletConfiguration = new AnnotationConfigWebApplicationContext();
dispatcherServletConfiguration.setParent(rootContext);
dispatcherServletConfiguration.register(webConfigClass);
LOGGER.debug("Registering Spring MVC Servlet - {} REST", restContextRoot);
ServletRegistration.Dynamic dispatcherServlet = servletContext.addServlet(restContextRoot + "-dispatcher", new DispatcherServlet(dispatcherServletConfiguration));
dispatcherServlet.addMapping("/" + restContextRoot + "/*");
dispatcherServlet.setLoadOnStartup(1);
dispatcherServlet.setAsyncSupported(true);
return dispatcherServlet;
}
示例3: initSpringRestComponent
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; //導入依賴的package包/類
protected ServletRegistration.Dynamic initSpringRestComponent(ServletContext servletContext, AnnotationConfigWebApplicationContext rootContext,
String name, String restContextRoot, Class<? extends WebMvcConfigurationSupport> webConfigClass) {
LOGGER.debug("Configuring Spring Web application context - {} REST", name);
AnnotationConfigWebApplicationContext dispatcherServletConfiguration = new AnnotationConfigWebApplicationContext();
dispatcherServletConfiguration.setParent(rootContext);
dispatcherServletConfiguration.register(webConfigClass);
LOGGER.debug("Registering Spring MVC Servlet - {} REST", name);
ServletRegistration.Dynamic dispatcherServlet = servletContext.addServlet(name + "-dispatcher", new DispatcherServlet(dispatcherServletConfiguration));
dispatcherServlet.addMapping(restContextRoot + "/*");
dispatcherServlet.setLoadOnStartup(1);
dispatcherServlet.setAsyncSupported(true);
return dispatcherServlet;
}
示例4: testInterceptorIsConfigured
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void testInterceptorIsConfigured() {
final Object configurerAdapter = context.getBean(TraceeSpringMvcConfiguration.TRACEE_WEBMVCCONFIGURERADAPTER_INTERNAL);
assertNotNull(configurerAdapter);
final WebMvcConfigurationSupport webmvc = context.getBean(WebMvcConfigurationSupport.class);
final List<Object> listeners = FieldAccessUtil.getFieldVal(webmvc, "interceptors");
Assert.assertThat(listeners, Matchers.hasItem(Matchers.instanceOf(TraceeInterceptor.class)));
}
示例5: test
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; //導入依賴的package包/類
@RequestMapping("/test")
public String test() {
return beanFactory.getBean(WebMvcConfigurationSupport.class).toString();
}