import java.lang.reflect.Method;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
public class TestServiceImpl implements TestService,ApplicationListener<ContextRefreshedEvent> {
@Resource
LuruWordService luruWordService;
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
System.out.println("------初始化执行 这里把所有的接口都遍历一遍 存到权限表里面----");
try {
// 获取上下文
ApplicationContext context = event.getApplicationContext();
// 获取所有beanNames
String[] beanNames = context.getBeanNamesForType(Object.class);
for (String beanName : beanNames) {
Controller conClass = context.findAnnotationOnBean(beanName,Con
初始化执行 这里把所有的接口都遍历一遍 存到权限表里面
最新推荐文章于 2022-01-27 17:40:11 发布