`
boogie
  • 浏览: 238019 次
  • 性别: Icon_minigender_1
  • 来自: 宁波
社区版块
存档分类
最新评论

Configure a bean with map property

阅读更多

1、Using XML

  <bean id="sqlService" class="SqlService">
    <property name="dataSourceMap">
      <map>
        <entry key="a">
          <ref bean="dataSourceA"/>
        </entry>
        <entry key="b">
          <ref bean="dataSourceB"/>
        </entry>
      </map>
    </property>
  </bean>

 2、Using the Spring DSL

beans = {
   def dsMap = new HashMap()
   dsMap.put('a',  ref('dataSourceA') )
   dsMap.put('b',  ref('dataSourceB') )

   sqlService(SqlService) {
       dataSourceMap = dsMap
  }
  ...
}
 
分享到:
评论

相关推荐

    thymeleaf-extras-springsecurity-3.0-master.zip

    As with normal Spring EL expressions, Thymeleaf allows you to access a series of objects from them including the context variables map (the #vars object). In fact, you are allowed to surround your ...

    RequestBody报400分析与解决方案.docx

    在 Spring MVC 中,我们可以使用两种方式来接收 JSON 格式的参数:使用 Bean 接收和使用 Map 接收。在使用 Bean 接收时,我们需要注意参数的对应关系,以免出现解析失败的问题。同时,我们也可以使用自定义的 ...

    spring flex BlazeDS 集成官方文档(英文)

    &lt;bean id="messageBroker" class="org.springframework.messaging.simp.config.MessageBrokerRegistry"&gt; &lt;property name="enableSimpleBroker" value="true"&gt; &lt;value&gt;/topic &lt;value&gt;/queue &lt;/property&gt; ...

    springmybatis

    &lt;property name="url" value="jdbc:mysql://127.0.0.1:3306/mybatis" /&gt; &lt;property name="username" value="root"/&gt; &lt;property name="password" value="password"/&gt; 3. 建立与数据库对应的 java...

    SpringMVC4整合tiles3

    -- Map all requests to DispatcherServlet for handling --&gt; &lt;servlet-name&gt;dispatcher &lt;url-pattern&gt;/ &lt;!-- Configure Tiles View Resolver --&gt; &lt;listener-class&gt;org.springframework.web.context....

Global site tag (gtag.js) - Google Analytics