All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.obatis.config.message.HttpEncodingConfiguration Maven / Gradle / Ivy

There is a newer version: 3.0.1-release
Show newest version
package com.obatis.config.message;

import com.obatis.constant.NormalCommonConstant;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CharacterEncodingFilter;

/**
 * 设置编码
 * @author HuangLongPu
 */
@Configuration
public class HttpEncodingConfiguration {

	@Bean
	@ConditionalOnMissingBean(CharacterEncodingFilter.class)
	public CharacterEncodingFilter encodingFilter() {
		CharacterEncodingFilter characterEncodingFilter = new OrderedCharacterEncodingFilter();
		characterEncodingFilter.setEncoding(NormalCommonConstant.CHARSET_UTF8);
		characterEncodingFilter.setForceRequestEncoding(true);
		characterEncodingFilter.setForceResponseEncoding(true);
		return characterEncodingFilter;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy