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

SDLang as a PropertySource for Spring Framework #62

Open
SingingBush opened this issue Dec 19, 2023 · 0 comments
Open

SDLang as a PropertySource for Spring Framework #62

SingingBush opened this issue Dec 19, 2023 · 0 comments
Assignees

Comments

@SingingBush
Copy link
Member

I've started a branch off of the annotation branch (as it requires multi-module project) which allows users to easily use SDL in Spring projects.
https://github.com/sdlang-dev/SDL/tree/feature/spring

basic usage would be to set some config:

    @Configuration
    @PropertySource(value = "classpath:my-test.sdl", factory = SdlPropertySourceFactory.class)
    public static class MySpringConfiguration {}

and then if the SDL file had a node such as author "Peter Parker" email="[email protected]" active=true

the nodes value and attributes could be injected using:

    @Value("${author}")
    private String authorValue; // will result in "Peter Parker" being injected

    @Value("${author|email}") // note that I may change this to "${author['email']}"
    private String authorEmailAttr;

    @Value("${author|active}") // note that I may change this to "${author['active']}"
    private Boolean authorActiveAttr;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant