java inject local variable in static method
Asked Answered
A

1

1

Is it possible to inject a local variable in java for a static method, like

@Inject
public void someMethod()
{
    @MyInjectQualifier MyObjectClass myobject;
    // use myobject here
}
Antecedence answered 16/6, 2014 at 17:56 Comment(2)
I don't see static anywhere...Haematogenesis
You can't. But you could use myObject as a parameter and do setter-injection.Dour
K
6

No, you cannot inject a value into a local variable through annotation processing at runtime.

Kofu answered 16/6, 2014 at 17:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.