Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Cloud Data Flow datasources overrides spring batch app datasource #5523

Closed
nvengatesan opened this issue Oct 22, 2023 · 2 comments
Closed
Labels
status/need-feedback Calling participant to provide feedback

Comments

@nvengatesan
Copy link

Description:
I am using scdf 2.6.0. My spring boot application is deployed via scdf.

I am using the same DB in scdf and spring boot application. My use case is, I want to use one datasource in scdf and another datasource in spring boot application. when I launch spring boot application, it always takes scdf datasource. How do I use my spring boot appplication datasource?

SCDF datasource:

spring:
datasource:
url: jdbc:mysql://localhost:5432/app_db?useSSL=false
username: user1
password: pass1

Spring boot application datasource:

datasource:
url: jdbc:mysql://localhost:5432/app_db?useSSL=true
username: user2
password: pass2

username and password and usessl will be different. spring boot application uses difference credential with ssl enabled, SCDF uses different credentials with ssl disabled. When I run spring boot application, it should run with ssl enabled, but it currently running scdf datasource properties.

Could you please provide how do I override scdf datasource?

@github-actions github-actions bot added the status/need-triage Team needs to triage and take a first look label Oct 22, 2023
@klopfdreh
Copy link
Contributor

If you want to configure a datasource beside the Spring Batch datasource within your task applications you can provide a bean like the following - with this you tell the batch framework to use this one. The other one can be use to fit your requirements:

    @Bean
    public DefaultBatchConfigurer batchConfigurer(@Qualifier("dataSource") DataSource dataSource, .....) {
        return new DefaultBatchConfigurer(dataSource) {
        ....
        }
    }

@cppwfs cppwfs added status/need-feedback Calling participant to provide feedback and removed status/need-triage Team needs to triage and take a first look labels Oct 30, 2023
@onobc
Copy link
Contributor

onobc commented Oct 30, 2023

We agree w/ the workaround above (thanks @klopfdreh) and are closing this based on that.

@onobc onobc closed this as completed Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/need-feedback Calling participant to provide feedback
Projects
None yet
Development

No branches or pull requests

4 participants