@Autowired vs @Inject

Is there any drawback to use JSR-330 @Inject as opposed to Spring specific @Autowired dependency injection annotation with jmix?
I have noticed that jmix examples are using @Autowired predominantly.

Thanks

There should be no problem with @Inject, but we recommend using @Autowired in new code as more idiomatic in Spring apps. Additionally, it provides the required = false option which allows injecting optional dependencies.

This is an old ticket, wondering if it is still valid. Cause in my case @Autowired gives warnings in all my screens because the screen itself is not a spring component.

@krivopustov is there something wrong in my setup? Screenshot below is from bookstore sample

image

It’s a regression caused by some changes in the latest IntelliJ Ultimate.
We have fixed it, the fix will be available in the next 2.0.4 patch.

1 Like