春季:获取注入到bean中的bean列表

时间:2019-08-17 10:55:45

标签: java spring

我正在寻找一种列出运行时注入到特定Spring bean中的bean的方法。例如,给定这两个类:

@Controller
public class TestController {

    @Autowired
    private TestComponent testComponent;

    private final TestService testService;

    public TestController(TestService testService) {
        this.testService = testService;
    }
}

@Service
public class TestService {

}

@Component
public class TestComponent {

}

TestController类的bean列表应返回:

  • TestService(通过构造函数注入)
  • TestComponent(通过@Autowired注解注入)

是否存在现有的Spring帮助程序/实用工具可以为我返回此信息?

0 个答案:

没有答案