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

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: [/*]
主站蜘蛛池模板: 普兰店市| 家居| 仙居县| 东港市| 甘谷县| 宝山区| 南宫市| 高清| 兴文县| 灵寿县| 泾阳县| 呼图壁县| 凤台县| 景东| 米易县| 叙永县| 苏尼特右旗| 凌源市| 革吉县| 湘乡市| 拉孜县| 临夏市| 竹溪县| 奉化市| 静安区| 揭东县| 自治县| 二连浩特市| 元谋县| 宁陕县| 丹巴县| 象山县| 神木县| 万安县| 汉寿县| 娄底市| 大田县| 崇阳县| 旬邑县| 虹口区| 隆回县|