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?

Was it helpful?

Solution

All method arguments should be resolvable by the application context. You can also use @Qualifer annotation to resolve ambiguities.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top