Inspectopedia 2025.2 Help

Inconsistent injection value in XML application context

Reports inconsistent tags and attributes on injection points in XML application contexts.

  • <property> and <constructor-arg> must specify a ref, value, or a sub-element

  • <property> and <constructor-arg> cannot contain more than one sub-element

  • <ref> can contain either a bean attribute, a local attribute, or a parent attribute

  • <ref> must specify a bean

  • <idref> can contain either a bean attribute or a local attribute

  • <idref> must specify a bean

  • <map> must specify a key

  • <idref> can contain either a key attribute, a key-ref attribute, or a <key> sub-element

Example:

<beans> <!-- 1. Property is only allowed to contain either "ref" attribute OR "value" attribute OR sub-element --> <bean class="MyClass"> <property name="bean" ref="myBean" value="foo"/> <!-- Property is only allowed to contain either "ref" attribute OR "value" attribute OR sub-element --> </bean> <!-- 2. Property must not contain more than one sub-element --> <bean class="MyFactory"> <property name="bean"> <ref>bean</ref> <!-- Property must not contain more than one sub-element --> <value>foo</value> <!-- Property must not contain more than one sub-element --> </property> </bean> <!-- 3. Map entry must specify a key --> <bean class="MyBean"> <property name="map"> <map> <entry value="foo"/> <!-- Map entry must specify a key --> </map> </property> </bean> </beans>

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

SpringInjectionValueConsistencyInspection
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Spring | Spring Core | XML

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection SpringInjectionValueConsistencyInspection

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2025.2, Qodana for JVM 2025.2,

Last modified: 18 September 2025