提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.framework.env.config; |
H |
2 |
|
|
3 |
import com.iailab.framework.common.enums.WebFilterOrderEnum; |
|
4 |
import com.iailab.framework.env.core.web.EnvWebFilter; |
|
5 |
import org.springframework.boot.autoconfigure.AutoConfiguration; |
|
6 |
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; |
|
7 |
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
|
8 |
import org.springframework.boot.web.servlet.FilterRegistrationBean; |
|
9 |
import org.springframework.context.annotation.Bean; |
|
10 |
|
|
11 |
/** |
|
12 |
* 多环境的 Web 组件的自动配置 |
|
13 |
* |
|
14 |
* @author iailab |
|
15 |
*/ |
|
16 |
@AutoConfiguration |
|
17 |
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) |
|
18 |
@EnableConfigurationProperties(EnvProperties.class) |
|
19 |
public class IailabEnvWebAutoConfiguration { |
|
20 |
|
|
21 |
/** |
|
22 |
* 创建 {@link EnvWebFilter} Bean |
|
23 |
*/ |
|
24 |
@Bean |
|
25 |
public FilterRegistrationBean<EnvWebFilter> envWebFilterFilter() { |
|
26 |
EnvWebFilter filter = new EnvWebFilter(); |
|
27 |
FilterRegistrationBean<EnvWebFilter> bean = new FilterRegistrationBean<>(filter); |
|
28 |
bean.setOrder(WebFilterOrderEnum.ENV_TAG_FILTER); |
|
29 |
return bean; |
|
30 |
} |
|
31 |
|
|
32 |
} |