All method arguments should be resolvable by the application context. You can also use @Qualifer
annotation to resolve ambiguities.
Autowired spring annotation on method with multiple arguments
-
16-06-2023 - |
Question
I know that I can use Autowired annotation on method.
for example:
@Autowired
public void someMethod(Object obj1, MyObj obj2, AnotherClass obj3, TestClass obj4){...}
What rules uses at this case?
obj1 obj2 obj3 obj4
should be in context?
or only one?
or nothing
Can I specified it?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow