0
    public static final String JDBC_DRIVER = value from yml;
    public static final String DB_URL = value from yml;
    public static final String DB_NAME = value from yml;
    public static final String USER = value from yml;
    public static final String PASSWORD = value from yml;
    public static final String PORT = value from yml;

the yml file:

database:
  host: url
  user: username
  password: password
  name: postgres
  port: 5432
  schema: project2

I've tried to use the @ Value annotation but that seems to be for spring framework and not for javelin.

Hiep Huynh
  • 21
  • 1
  • 2
  • Javalin does not provide annotations out-of-the-box. Javalin also does not make any assumptions about what format of properties file you may want to use. So, you can just add whatever your preferred YAML Java library is, and use that in the usual way (but even then, I am not aware of any such libraries which use annotations - maybe someone can provide an example.) – andrewJames Aug 24 '22 at 22:40
  • I'd suggest [jackson-dataformat-yaml](https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml), simply because Javalin does use Jackson in its [bundled version](https://mvnrepository.com/artifact/io.javalin/javalin-bundle) of Javalin (for JSON). – andrewJames Aug 24 '22 at 22:40

0 Answers0