Announcement Announcement Module
Collapse
No announcement yet.
set up bean property dynamically? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • set up bean property dynamically?

    Hello,

    I need to change a property of an already registered bean on execution time. So I will set up the bean with default values and need to change some of them depending on any actions. Does anyone has a solution for this?

    Thank you,
    nort

  • #2
    Hi nort

    If your bean is a singleton you can have a little bit of Spring-dependant code actually pull the bean from the container (the ApplicationContext) and mutate the value in plain old Java code. Everything that has been dependency-injected with the supplied bean reference will (of course) then see the updated value(s).

    When exactly do you need to change the property value(s)? Exactly once after startup, many times, in response to events, etc? When?

    Cheers
    Rick

    Comment


    • #3
      I have to change the property of a dao, depending on the data of the incomming client call to the service.

      So it would be fine, if I could change the property of this dao with e.g. an aspect, forward the request to the service which uses the "patched" dao.

      Comment

      Working...
      X