I am using component-scan in my spring application. So in spring context I created map:
<util:map id="mapByName" map-class="java.util.concurrent.ConcurrentHashMap">
<entry key="Name1" value-ref="MyCustomClassName1" />
</util:map>
and in my class annotated by @Service I want to inject this property:
@Inject
private Map<String, MyCustomClassName1> mapByName;
this is still working. Problem just in name of key. When I print this property I got [MyCustomClassName1=org.my.package.service.MyCustomClassName1@cb52f2]
so as you can see name of key is changed from Name1->MyCustomClassName1 (Name of this class). So my question is how to define custom key name in map property ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…