本文整理汇总了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();
}