-1

Is it possible to load backend server URL from properties file in MobileFirst 7.1 Java Adapter, without reading properties every time? What will happen if someone changes the URL while the adapter is already deployed? The target is to build adapter for for all environments(DEV, TEST, PROD etc.) and keep backend URLs outside .adapter file.

Shrirang
  • 23
  • 4

1 Answers1

0

You cannot keep the URL the adapter is meant to connect to outside of the adapter implementation.

In Java adapters you define and create the connection in Java code.

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • I am confused about life cycle of adapter, when will be the init method of AdapterApplication class is called? Is it possible to load properties file from init and then use it in resource class? Pardon my knowledge of MobileFirst Java adapters/JAX-RS implementation – Shrirang Nov 16 '16 at 13:03
  • The init method is called once the adapter is deployed (or if already deployed and you restart the server). In theory you could possibly load a file to memory and read its contents and then run some backend logic to decide which address to use, but why? Just hard-code all of them, why mess with loading external files... – Idan Adar Nov 16 '16 at 13:14
  • The project deployment team insists that the configuration part be in properties file instead of hard coding, so they can reuse .adapter file without re-building the code by just changing the properties file. Thanks for the answer @Idan. – Shrirang Nov 16 '16 at 13:37