Database property

I have created a system property in the cuba core using the Administration > Application Properties page. it is now in the SYS_CONFIG table

I have a service bean that needs to access it, but found that AppContext.getProperty() doesn’t have access tot he DB properties as described on the page (Application Properties - CUBA Platform. Developer’s Manual )

What is the best way in the CUBA.platform to access this property stored in the database?

Hi Alex,

Expected way to access your DB properties from the source code is using configuration interfaces. Documentation on this is available here. When you have your configuration interface simply inject it into a bean and call getter for a property.

Regards,
Aleksey

This worked great thanks! I was trying to access the property getters in the service bean constructors, but that was throwing a null pointer. Once I changed that and called the getters after the service bean was already created, it worked great. Thanks :slight_smile: