Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring can't autowire Map bean
    primarykey
    data
    text
    <p>I've defined a map in spring as such:</p> <pre><code>&lt;util:map id="AdditionalParams" scope="prototype" map-class="java.util.HashMap" key-type="java.lang.String" value-type="java.lang.String"&gt; &lt;entry key="Start" value="12345" /&gt; &lt;entry key="Finish" value="12365" /&gt; &lt;/util:map&gt; </code></pre> <p>And then I'm autowiring this bean to a property defined as:</p> <pre><code>private @Autowired @Qualifier(value = "AdditionalParams") Map&lt;String, String&gt; additionalParams; </code></pre> <p>When doing this, the an exception get's thrown saying that:</p> <blockquote> <p>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DutyCreator': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.util.Map DutyCreator.additionalParams; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [java.lang.String] found for dependency [map with value type java.lang.String]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=AdditionalParams)}</p> <p>Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [java.lang.String] found for dependency [map with value type java.lang.String]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=AdditionalParams)}</p> </blockquote> <p>Any ideas?</p> <p>Cheers.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload