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

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: [/*]
主站蜘蛛池模板: 桦南县| 永修县| 抚顺县| 新巴尔虎右旗| 沐川县| 华坪县| 离岛区| 徐闻县| 涡阳县| 治多县| 北流市| 隆化县| 光山县| 威信县| 志丹县| 镇江市| 中卫市| 祁门县| 三穗县| 宁国市| 镇沅| 蓬溪县| 吉木萨尔县| 长宁区| 丽水市| 钟祥市| 高密市| 松滋市| 怀化市| 德昌县| 策勒县| 中阳县| 三江| 岗巴县| 和政县| 兖州市| 金门县| 福建省| 如东县| 泾川县| 邵东县|