官术网_书友最值得收藏!

How to do it...

  1. It is a good idea to separate and group the configurations into different classes in order to provide more clarity about what kind of things are being configured. So, let's create a separate configuration class called WebConfiguration in the src/main/java/com/example/bookpub directory from the root of our project with the following content:
@Configuration 
public class WebConfiguration { 
    @Bean 
    public RemoteIpFilter remoteIpFilter() { 
        return new RemoteIpFilter(); 
    } 
} 
  1. Start the application by running ./gradlew clean bootRun.
  2. In the startup log, we should see the following line, indicating that our filter has been added:
...FilterRegistrationBean : Mapping filter: 'remoteIpFilter' to: [/*]
主站蜘蛛池模板: 锦州市| 饶平县| 吴忠市| 河北省| 碌曲县| 凭祥市| 武宣县| 盱眙县| 桓仁| 马龙县| 湖口县| 手游| 高尔夫| 临澧县| 乌兰浩特市| 宜黄县| 娄烦县| 攀枝花市| 吐鲁番市| 邵阳市| 长春市| 万州区| 安达市| 茂名市| 读书| 鹤山市| 靖边县| 鲁山县| 来安县| 郴州市| 红安县| 拉萨市| 久治县| 东安县| 浏阳市| 鹰潭市| 吉水县| 原阳县| 平和县| 兴文县| 余庆县|