2 回答

TA貢獻(xiàn)1873條經(jīng)驗 獲得超9個贊
看起來您正在自定義 Spring Cloud Data Flow 服務(wù)器以使用我認(rèn)為不需要的應(yīng)用程序數(shù)據(jù)源。
您可以像上面發(fā)布的那樣啟動您的 SCDF 服務(wù)器:
1.?Run?skipper?server:?java?-jar?spring-cloud-skipper-server-2.0.3.RELEASE.jar?& 2.?Run?Dataflow?server:?java?-jar?spring-cloud-dataflow-server-2.1.2.RELEASE.jar?\ ????--spring.datasource.url=jdbc:postgresql://10.136.66.44:8080/springclouddataflow?\ ????--spring.datasource.username=springclouddataflow?\ ????--spring.datasource.password=123456?\ ????--spring.datasource.driver-class-name=org.postgresql.Driver?\ ????--server.port=80?&
并且,讓您的 Spring 批處理應(yīng)用程序?qū)⑵鋽?shù)據(jù)源屬性作為 Spring Boot 屬性傳遞,而不是像上面那樣使用自定義數(shù)據(jù)源配置。

TA貢獻(xiàn)1998條經(jīng)驗 獲得超6個贊
只是你嘗試在你的應(yīng)用程序中添加動態(tài)數(shù)據(jù)源,然后你在需要的地方自動連接你的動態(tài)數(shù)據(jù)源
@Configuration
public class DataSourceConfig {
@Bean(name = "testingDataSource")
@ConfigurationProperties(prefix = "testing.datasource")
public DataSource testDataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "testingJdbcTemplate")
public JdbcTemplate testJdbcTemplate(@Qualifier("testingDataSource") DataSource dsMySQL) {
return new JdbcTemplate(dsMySQL);
}
}
測試:數(shù)據(jù)源:driverClassName:'com.mysql.cj.jdbc.Driver' jdbc-url:'jdbc:mysql://localhost/dbName' 用戶名:'uname' 密碼:'passwordcd'
添加回答
舉報