我有一个XML文件,它具有相同类的两个不同数据库池的属性。两者都有一个属性图。我需要将一个地图绑定到一个实例,而将另一个地图绑定到另一个实例。我怎么做?
绑定代码 bind(bindClass).annotatedWith(Names.named(bindName))。to(instanceClass).in(Singleton.class)
XML文件
<pool>
<name>pool-1</name>
<instance-class>com.SomeClass</instance-class>
<ind-class>javax.sql.DataSource</bind-class>
<singleton>true</singleton>
<capacity>10</capacity>
<timeout>30s</timeout>
<host>mysql-01/host>
<port>3306</port>
<user>test</user>
<password encrypted="true">******</password>
</pool>
<pool>
<name>pool-2</name>
<instance-class>com.SomeClass</instance-class>
<ind-class>javax.sql.DataSource</bind-class>
<singleton>true</singleton>
<capacity>10</capacity>
<timeout>30s</timeout>
<host>mysql-02/host>
<port>3306</port>
<user>test</user>
<password encrypted="true">******</password>
</pool>