留言板
Liferay DXP portlet.properties
Hi Everyone,
As we are using PortletProps.get("property.name") in liferay 6.2 to get property value from portlet's portlet.properties file,
Is someone knows that how can i do same in liferay DXP?
Thanks & Regards,
Ravi Darji
As we are using PortletProps.get("property.name") in liferay 6.2 to get property value from portlet's portlet.properties file,
Is someone knows that how can i do same in liferay DXP?
Thanks & Regards,
Ravi Darji
David H Nebinger,修改在7 年前。
RE: Liferay DXP portlet.properties
Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
It is available for portlet wars, but for OSGi you should be switching over to Configuration Admin (OSGi). There's doco in dev.liferay.com for this and examples in the Liferay source.
for reference, here's a link to documentation on configuration: https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/making-your-applications-configurable
Use this piece of code to read portlet.properties
Configuration configuration = ConfigurationFactoryUtil.getConfiguration(PortalClassLoaderUtil.getClassLoader(), "portlet");
Configuration configuration = ConfigurationFactoryUtil.getConfiguration(PortalClassLoaderUtil.getClassLoader(), "portlet");
David H Nebinger,修改在6 年前。
RE: Liferay DXP portlet.properties
Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子Liferay Dev:
Use this piece of code to read portlet.properties
Configuration configuration = ConfigurationFactoryUtil.getConfiguration(PortalClassLoaderUtil.getClassLoader(), "portlet");
What? This is totally confusing. You're going to use the portal class loader, the one where none of your code is actually running? And what is "portlet"? Did you mean for this to be a placeholder for a portlet name or id or service or what?
Answering forum questions is always welcome, but keep in mind that there are people reading these posts with different levels of experience and often you need to provide some contextual details. A newbie trying this code is going to be completely stymied trying to understand why it is not working or trying to adapt it to their project.
Come meet me at Devcon 2017 or 2017 LSNA!