Describe the bug
When you put @Autowired annotation of the setter method the injection is not happened. As a result NPE is thrown.
To Reproduce
mvn verify -Dtest=org.otaibe.quarkus.jpa.tests.web.controller.LocationsControllerTest#testDestinationEndpoint
/cc @geoand
Interesting, thanks!
@mkouba @manovotn does @Inject work on setters for CDI beans?
Yes, it should work. In fact, in CDI this kind of injection is called "initializers" and multiple injected params are supported. I did a quick search and there is a test for private setter: https://github.com/quarkusio/quarkus/blob/master/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/privateinitializer/PrivateInitializerInjectionTest.java#L33-L36.
@geoand how do you implement @Autowired? Is there an annotation trasnformer that perform the replacement @Autowired -> @Inject?
Yeah, I just saw it's my bad @mkouba :)
I have only implemented the transformation for fields, not methods :man_facepalming:
I'll send a PR for this later on tonight
Had a few minutes before heading out to the gym, so I opened #7421 :)