Using Required for system configurations.
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
Legacy Article
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
Issue
- We would like to add required = true configuration to our system configuration.
- Upon requesting the data through a groovy script the string returns empty when required = true is set.
Resolution
- Sadly this is currently a limitation of ConfigurationProviderUtil.getSystemConfiguration.
- However currently there is a feature request that aims to address this behavior.
- In case you definitely need the required = true properties, you should fetch the configuration by ConfigurableUtil like below:
@Component(
configurationPid = "com.custom.search.suggestion.conf.RBIDidYouMeanConfiguration",
service = TestComponent.class
)
public class TestComponent {
@Activate
@Modified
protected void activate(Map<String, Object> properties) {
_RBIDidYouMeanConfiguration = ConfigurableUtil.createConfigurable(
RBIDidYouMeanConfiguration.class, properties);
}
private volatile RBIDidYouMeanConfiguration
_RBIDidYouMeanConfiguration;
}
Did this article resolve your issue ?