Reputation: 16992
I have a rest service developed using spring boot. I have imported a number of external libraries which have some interceptors. Is there a way to print the list of interceptors along with order in which they will be triggered?
Upvotes: 1
Views: 1427
Reputation: 22506
You can inject all beans of given type (in that case you can use the org.springframework.web.servlet.HandlerInterceptor
interface) in any of your components. So if you want to print(or do something else with) all interceptors you can do something like this:
@Component
public class SomeBean {
@Autowired
private List<org.springframework.web.servlet.HandlerInterceptor> interceptors;
@PostConstruct //not required, but you can use it to print at the app startup
public void printInterceptors() {
//TODO use this.interceptors
}
}
Also, I guess that Spring prints the interceptors on startup, maybe in the debug log.
Upvotes: 4