ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(true); scanner.addIncludeFilter(new AnnotationTypeFilter(Tenant.class)); Set<BeanDefinition> beanDefinitions = scanner.findCandidateComponents("com.example.spex"); beanDefinitions.forEach(e -> { System.out.println(e.getBeanClassName()); });
package com.example.spex.demos.web; import java.util.List; @Tenant public class UserDTO { private String code; private List<User> content; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public List<User> getContent() { return content; } public void setContent(List<User> content) { this.content = content; } }
标签:code,scanner,自定义,spring,List,content,注解,public,String From: https://www.cnblogs.com/gstsyyb/p/17962233