package cn.edu.tju.controller;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.security.web.FilterChainProxy;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class NewController implements ApplicationContextAware {
private ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext=applicationContext;
}
@RequestMapping("/getFilterChainProxyBeanName")
public String test(){
String[] beanNamesForType = applicationContext.getBeanNamesForType(FilterChainProxy.class);
System.out.println("FilterChainProxy类型的bean的数量");
System.out.println(beanNamesForType.length);
return beanNamesForType[0];
}
}
接口/getFilterChainProxyBeanName的输出结果
springsecurityFilterChain