Skip to content

Commit f684fc7

Browse files
SONARJAVA-4649 Improve rule description: let it apply more generically to dependency injection frameworks (#4492)
1 parent a02adef commit f684fc7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • java-checks/src/main/resources/org/sonar/l10n/java/rules/java

java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S6813.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h2>Why is this an issue?</h2>
2-
<p>Spring supports dependency injection by using annotations such as <code>@Autowired</code>. This annotation can be used to inject beans via
3-
constructor, setter, and field injection.</p>
2+
<p>Dependency injection frameworks such as Spring support dependency injection by using annotations such as <code>@Inject</code> and
3+
<code>@Autowired</code>. These annotation can be used to inject beans via constructor, setter, and field injection.</p>
44
<p>Generally speaking, field injection is discouraged. It allows the creation of objects in an invalid state and makes testing more difficult. The
55
dependencies are not explicit when instantiating a class that uses field injection.</p>
66
<p>Apart from that, field injection is not compatible with final fields. Keeping dependencies immutable where possible makes the code easier to

0 commit comments

Comments
 (0)