question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable isolation of config properties into a separate POJO

See original GitHub issue

Hi,

i think it would be a nice feature to add another annotation e.g. @ConfigProperties which would allow injecting a group of properties with the same prefix into a separate POJO. This would reduce the amount of @Inject and @ConfigProperty annotations and would allow better usage of the same set of properties across multiple classes.

microprofile-config.properties:

person.data.firstName=John
person.data.lastName=Smith

Example class:

@ConfigProperties(prefix = "person.data")
public class PersonData {
  private String firstName;
  private String lastName;
  ...
}

Referencing PersonData:

public class Person {
  @Inject
  private PersonData personData;
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:23 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
rmannibucaucommented, Apr 16, 2018

Issue with a pojo is you cant do much and actually just stay on the existing features whereas a proxy enables to:

  1. Support scopes (which is key here otherwise inconsistencies are trivial to create).
  2. Supports additional features (interceptors, caching, reloading etc…)

Getters are then not needed at all and you just used methods, trivial model and efficient 😃

0reactions
Emily-Jiangcommented, Sep 7, 2020

Need to reopen this for further update based on some feedback and discussion on the google group mailinglist.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guide to @ConfigurationProperties in Spring Boot - Baeldung
The official documentation advises that we isolate configuration properties into separate POJOs. So let's start by doing that:
Read more >
Binding external configurations to POJO classes - CalliCoder
Enter config-properties-demo in the Artifact field. · Set Package name to com.example.demo · Add Web and Validation in the dependencies section.
Read more >
Use application.properties in a non-spring injected class
You can start by isolating configuration properties into separate POJOs. Then let spring boot inject the values into the POJO. You can use...
Read more >
Externalized Configuration of Spring Boot application with ...
The official documentation advises to isolate the configuration properties in separate POJOs. If you define a set of configuration keys for ...
Read more >
3.4. Optional configuration properties
There are a number of other properties that control the behaviour of Hibernate at runtime. All are optional and have reasonable default values....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found