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

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: [/*]
主站蜘蛛池模板: 南汇区| 阿坝县| 会同县| 澄城县| 明水县| 广水市| 长春市| 林芝县| 内丘县| 梅河口市| 灵山县| 长武县| 石嘴山市| 海南省| 烟台市| 抚顺市| 锡林浩特市| 慈溪市| 镇巴县| 蕲春县| 双鸭山市| 扶余县| 普洱| 万山特区| 明溪县| 偏关县| 大丰市| 皋兰县| 班戈县| 当涂县| 临城县| 个旧市| 巴东县| 日土县| 洛宁县| 巴马| 红原县| 阿拉善左旗| 沾益县| 依安县| 米易县|