我们正在使用oracle-proxy配置来构建dateSource。在XML中:
<orcl:pooling-datasource id="dataSource" url="${oracle.url}"
username="${oracle.username}" password="${oracle.password}">
<orcl:connection-properties>validationQuery=select 1 from dual</orcl:connection-properties>
<orcl:connection-cache-properties>ValidateConnection=true</orcl:connection-cache-properties>
<orcl:username-connection-proxy
connection-context-provider="usernameProvider" />
</orcl:pooling-datasource>
<!-- Configure bean UserProvider -->
<bean id="usernameProvider" class="com.provider.UserProvider" />
UserProvider
:类实现ConnectionUsernameProvider
以获取连接的用户名。它有效!
现在我们切换到Spring-boot
。我们如何使用ProxyDataSource
/ OracleDataSource
?