0
私のdb設定ファイルを使用して2つのデータベースに接続しようとしています。私はデータソースのための2番目のBeanを定義する場合、私は書き込み不可能なプロパティの例外があります。 2つのデータソースを定義する正しい方法はどれですか?そして私は私のJavaクラスで何かする必要がありますか?Spring Frameworkが複数のデータベースに接続しています。JAVA
データ-source.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://localhost:5432/test" />
<property name="username" value="root" />
<property name="password" value="root" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>
</beans>
ここでは、複数のデータベースとJPAのアノテーションを使用する方法を、説明だし、 '@ Configuration' http://www.baeldung.com/spring-data-jpa-multiple-databases –
これでそれを設定する方法例は休止状態でそれを行う方法です(しかし私はそれを使用しません)。私はすでに解決策を見つける。 – RockOrDead