Hi,
using Sonarqube Enterprise 9.9.0 with sonar-java-plugin-7.16.0.30901
This raises an issue for java:S3749 ‘Members of Spring components should be injected’
import jakarta.annotation.Resource;
[...]
@Resource
private RequestData requestData;
Even the latest version of Sonar Java, see https://rules.sonarsource.com/java/?search=Members%20of%20Spring%20components%20should%20be%20injected
has
This rule raises an issue when a singleton
@Component
,@Controller
,@Service
, or@Repository
, not annotated with@ConfigurationProperties
, has non-static
members that are not annotated with one of:
[…]
javax.annotation.Resource
But with Spring 3 it’s jakarta.annotation.Resource
. instead of javax.annotation.Resource
see
The Spring boot 3 release notes mention the use of Jakarta EE 9 (jakarta) instead of JEE (javax)
has
If you are trying an existing application with Spring Boot 3.0 you’ll need to be aware that we’ve migrated all Java EE APIs to their equivalent Jakarta EE variant.
Gilbert