Inspectopedia Help

Unnecessary autowired dependency in XML application context

Reports autowire attributes in <bean> elements and suggests to explicitly inject bean properties if possible.

Example:

public class MyComponent { public void setOtherBean(OtherBean bean){...} }
<beans> <bean class="beans.OtherBean" id="bar"/> <bean autowire="byType" class="beans.MyComponent"/> <!-- "Unnecessary autowired dependency" --> <!-- suggests "Make autowired dependency explicit" --> </beans>
<beans> <bean class="beans.OtherBean" id="bar"/> <bean class="beans.MyComponent" id="foo"> <property name="otherBean" ref="otherBean"/> </bean> </beans>

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Spring, 241.14841

Last modified: 12 March 2024