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

Allow lazy loading of the data sources #442

Open
ikovalyov opened this issue Mar 29, 2021 · 3 comments
Open

Allow lazy loading of the data sources #442

ikovalyov opened this issue Mar 29, 2021 · 3 comments

Comments

@ikovalyov
Copy link

We don't need to load datasources in our web app, or tests. We need it only if app is loaded from the command line. Unfortunately there is no way to do a lazy loading of the datasources as it is annotated with @Context

@ikovalyov ikovalyov changed the title Allow conditional loading of the data sources Allow lazy loading of the data sources Mar 29, 2021
@dstepanov
Copy link
Contributor

You should probably have a different profile where data-sources properties are only provided in the command line profile.

@sdelamo
Copy link
Contributor

sdelamo commented Jun 2, 2021

@ikovalyov

what you could do is to move the datasources block to a configuration file such as application-cli.yml.

Then it would not be loaded unless you run with environments such as cli

@nhoughto
Copy link

Would love this, causing a bit of pain atm with shared/inherited config, where datasource config is specified at a higher level and this triggers downstream components to try and construct the Datasource where i'd like them not to.

I believe the idiomatic micronaut way to do this is to support io.micronaut.core.util.Toggleable and then configure the data source as enabled: false at a higher level, and then enabled: true at the lower level. Lots of other areas/configurations support this Toggleable but not Datasource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants