I want to inject result of method call to my class. I have next code:
class Example {
private static final String NAME = "name";
// #1
@Autowired
@Qualifier("a.b")
private B b;
// #2
@Autowired
@Qualifier("#{a.b}")
private B b;
// #3
@Autowired
@Qualifier("#{a.b.getC('" + NAME + "')}")
private C c;
}
So I have 3 different variants. First one is working, second one is not working but not sure whether I wrote SpEL correctly and third one is not working too.
Actually what I need is third variant. I need to inject result of calling method "getC(name)" on bean called "a.b"
Maybe somebody had similar problem and know how to do it?