[jbossts-issues] [JBoss JIRA] (JBTM-3214) Add a BeanPopulator method to directly provide a config bean

Michael Musgrove (Jira) issues at jboss.org
Wed Oct 23 12:15:00 EDT 2019


     [ https://issues.jboss.org/browse/JBTM-3214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Musgrove updated JBTM-3214:
-----------------------------------
    Fix Version/s: 5.next
                       (was: 5.9.8.Final)


> Add a BeanPopulator method to directly provide a config bean
> ------------------------------------------------------------
>
>                 Key: JBTM-3214
>                 URL: https://issues.jboss.org/browse/JBTM-3214
>             Project: JBoss Transaction Manager
>          Issue Type: Sub-task
>          Components: Configuration
>    Affects Versions: 5.9.8.Final
>            Reporter: Michael Musgrove
>            Assignee: Michael Musgrove
>            Priority: Optional
>             Fix For: 5.next
>
>
> 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:
> {code}
>     public static void setBeanInstance(String name, Object beanInstance) {
>         beanInstances.putIfAbsent(name, beanInstance);
>     }
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the jbossts-issues mailing list