Saturday, January 31, 2015

Show registered servlet filters' information in Spring Boot

To show registered servlet filters' information in Spring Boot,

just see your INFO level logs in your console:

2015-02-01 14:52:15.204  INFO 1394 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'characterEncodingFilter' to: [/*]
2015-02-01 14:52:15.205  INFO 1394 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'springSecurityFilterChain' to: [/*]
2015-02-01 14:52:15.205  INFO 1394 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'mySiteMeshFilter' to urls: [/*]
2015-02-01 14:52:15.205  INFO 1394 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2015-02-01 14:52:15.205  INFO 1394 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'dispatcherServlet' to [/]

As you can see, there is also information on a registered servlet.

If you use a version since 1.2.2.BUILD-SNAPSHOT,

you can see more detailed information on servlet filters in DEBUG level logs as follows:

2015-02-01 14:56:17.701 DEBUG 1427 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Added existing Filter initializer bean 'securityFilterChainRegistration'; order=0, resource=class path resource [org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.class]
2015-02-01 14:56:17.701 DEBUG 1427 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Added existing Filter initializer bean 'sitemeshFilter'; order=2147483647, resource=class path resource [samples/springboot/ServletFilterConfig.class]
2015-02-01 14:56:17.701 DEBUG 1427 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Added existing Servlet initializer bean 'dispatcherServletRegistration'; order=2147483647, resource=class path resource [org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration$DispatcherServletConfiguration.class]
2015-02-01 14:56:17.730 DEBUG 1427 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'characterEncodingFilter'; order=-2147483648, resource=class path resource [org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfiguration.class]
2015-02-01 14:56:17.730 DEBUG 1427 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'hiddenHttpMethodFilter'; order=2147483647, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.class]
2015-02-01 14:56:17.743 DEBUG 1427 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created EventListener initializer for bean 'requestContextListener'; order=2147483647, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]

Reference:
https://github.com/spring-projects/spring-boot/issues/2177

No comments:

Post a Comment