Reading project defined properties file

Hi everyone,

I am new to Cuba and finding a bit difficulties in getting started. I am trying to keep messages in a properties file in core module. Various apis are created that should read messages from this properties file.

What would be the best way to implement this?

I am placing this file at the level where app.properties is, updated web.xml with this new file. What code should I need to load this ? (Trying to do following

@Inject
@Resource()
private lateinit var messages:Resources

)

Hi,
What are you going to use this properties file for? To store configuration, or to store localized messages?

CUBA has built-in mechanisms for both, so you don’t need to load files manually.

You can create configuration interface and map its properties to properties stored in the app.properties file:
https://doc.cuba-platform.com/manual-7.2/config_interface_usage.html

For localized messages, you can create messages.properties file and use the Messages bean to retrieve them:
https://doc.cuba-platform.com/manual-7.2/message_packs.html

Regarding what you are trying to do - you can use the Resources bean to load any file from the classpath: Resources - CUBA Platform. Developer’s Manual