How to read Jmx Database Property

In a service I would like to check the value of a property I created
calling from Administrator-> JmxConsole-> setDbProperty
ā€¦ can someone show me an example of code for reading the property
with getDbProperty ?

Tanks, Massimo.

Hi,

Take a look at Configuration interfaces.

You can use them with SourceType.DATABASE:

@Source(type = SourceType.DATABASE)
public interface SalesConfig extends Config {

    @Property("sales.companyName")
    String getCompanyName();

    @Property("sales.ftpPassword")
    @Secret
    String getFtpPassword();
}

And then read property as follows:

@Inject
private SalesConfig salesConfig;

public void doSomething() {
    String name = salesConfig.getCompanyName();
    ...
}
2 Likes

Great, it worked perfectly
thank you!