2 回答

TA貢獻1873條經驗 獲得超9個贊
看起來您正在自定義 Spring Cloud Data Flow 服務器以使用我認為不需要的應用程序數據源。
您可以像上面發布的那樣啟動您的 SCDF 服務器:
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 批處理應用程序將其數據源屬性作為 Spring Boot 屬性傳遞,而不是像上面那樣使用自定義數據源配置。

TA貢獻1998條經驗 獲得超6個贊
只是你嘗試在你的應用程序中添加動態數據源,然后你在需要的地方自動連接你的動態數據源
@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);
}
}
測試:數據源:driverClassName:'com.mysql.cj.jdbc.Driver' jdbc-url:'jdbc:mysql://localhost/dbName' 用戶名:'uname' 密碼:'passwordcd'
添加回答
舉報