首页 > 解决方案 > 基于 Spring 函数的注入

问题描述

有什么方法可以使用@Autowired 注入spring bean,而不是使用限定符,而是使用基于函数和参数解析bean 的自定义注释?

例如

@Autowired
@FunctionQualifier(method=fetchCorrectBean)
private MyService myService;

fetchCorrectBean 是一个函数,它将从应用程序上下文中获取 bean 并将其注入。

标签: springdependency-injection

解决方案


推荐阅读