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
private lateinit var messages:Resources
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:
For localized messages, you can create messages.properties file and use the Messages bean to retrieve them:
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