开发者

Spring map entries versus resources

开发者 https://www.devze.com 2023-01-10 05:00 出处:网络
Consider a factory bean. It takes a single property of type Map<String, Object>. It carefully checks all the Objects for \'instanceof Resource\' and does resource processing appropriately.

Consider a factory bean. It takes a single property of type Map<String, Object>. It carefully checks all the Objects for 'instanceof Resource' and does resource processing appropriately.

I configure this bean like:

<bean id='fact' class='my.class'>
  <property name='map'>
    <map>
      <entry key="x" value="file:/WEB-INF/foo.txt"/>
    </map>
  </property>
 </bean>

In the debugger, I see that the setter for the property is called with a Map, and the value is a java.lang.String with the file: still sitting on it.

Since there is no explicit prefix for servlet context resources, I am now officially puzzled.

In my previous question, the 'solution' turned out to be to correct a really stupid default configuration of the maven-jetty-plugin.

Apologies for the rewrit开发者_如何学Goe, but no one answered yet :-)


More and more googling eventually revealed:

<entry key="grammarURL">
            <value type="org.springframework.core.io.Resource">classpath:/com/basistech/ras/rules.jape</value>
</entry>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号