-
Sub-task
-
Resolution: Done
-
Optional
-
5.9.8.Final
-
None
Narayana has quite a flexible mechanism for setting properties:
- it uses xml property files
- it reads Java system properties
- it initialises our config beans using reflection to call the setters
Some systems, Quarkus for example, have their own config mechanisms (MicroProfile Config in the Quarkus example) so it makes sense to allow our beans to be configured directly (avoiding parsing and reflection).
Implementation wise we do already have the PropertiesFactory class to directly provide config properties but that code still uses reflection to set the actual property values and besides, it is an abstract class so we cannot safely add new methods to it. My proposal is to add a single method to the BeanPopulator class:
public static void setBeanInstance(String name, Object beanInstance) { beanInstances.putIfAbsent(name, beanInstance); }
This code avoids the use of reflection (and possibly xml parsing) whenever access to the named bean is required. Note that this approach requires a user to know in advance which environment beans Narayana is using.
- is related to
-
JBTM-3215 Rethink the system of configuration and properties with narrowing the API
- Open