首页>代码>工作流activiti-explorer在线设计器的整合 适合大多数自定义工作流流程审批系统>/activiti-explorer/src/main/java/org/activiti/explorer/servlet/DispatcherServletConfiguration.java
package org.activiti.explorer.servlet; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; import org.springframework.web.servlet.i18n.SessionLocaleResolver; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import com.fasterxml.jackson.databind.ObjectMapper; @Configuration @ComponentScan({"org.activiti.rest.editor", "org.activiti.rest.diagram"}) @EnableAsync public class DispatcherServletConfiguration extends WebMvcConfigurationSupport { private final Logger log = LoggerFactory.getLogger(DispatcherServletConfiguration.class); @Autowired private ObjectMapper objectMapper; @Autowired private Environment environment; @Bean public SessionLocaleResolver localeResolver() { return new SessionLocaleResolver(); } @Bean public LocaleChangeInterceptor localeChangeInterceptor() { log.debug("Configuring localeChangeInterceptor"); LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); localeChangeInterceptor.setParamName("language"); return localeChangeInterceptor; } @Bean public RequestMappingHandlerMapping requestMappingHandlerMapping() { log.debug("Creating requestMappingHandlerMapping"); RequestMappingHandlerMapping requestMappingHandlerMapping = new RequestMappingHandlerMapping(); requestMappingHandlerMapping.setUseSuffixPatternMatch(false); Object[] interceptors = {localeChangeInterceptor()}; requestMappingHandlerMapping.setInterceptors(interceptors); return requestMappingHandlerMapping; } @Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { addDefaultHttpMessageConverters(converters); for (HttpMessageConverter<?> converter: converters) { if (converter instanceof MappingJackson2HttpMessageConverter) { MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = (MappingJackson2HttpMessageConverter) converter; jackson2HttpMessageConverter.setObjectMapper(objectMapper); break; } } } @Override protected void configureContentNegotiation(ContentNegotiationConfigurer configurer) { configurer.favorPathExtension(false); } }
最近下载更多
最近浏览更多
whfuai LV14
9月28日
HANCW LV9
8月20日
云破月 LV8
4月12日
denglu123321 LV4
4月11日
Gin19960217 LV4
3月5日
1049066887 LV13
3月3日
weilaizhisheng LV21
1月16日
zhong8876 LV1
2023年11月29日
yuan_bin1990 LV7
2023年11月13日
3334004690 LV10
2023年11月1日