Domanda

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?

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top