Announcement Announcement Module
Collapse
No announcement yet.
Dynamic Dependency Injection Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic Dependency Injection

    Good morning,

    I've worked with JBoss Seam, and a functionality that I miss in Spring is the use of injection dynamics.

    I find this feature very useful in some situations. In the Spring we could, for example, in a web context, have an Application scoped bean, which has a dependency on Session scope. Or a bean Session scoped, with a reliance on scoped Request.

    And these dependencies would be reinjected in the beans whenever the container to be created, not just once (at the time of creation of the bean), such as Spring does today.

    Today my solution to this type of scenario are the lookup-methods. It is an approach that does not please me much, with all respect.

    They consider this useful feature? I'm thinking to hold a fork of Spring to develop, but only if the community is in agreement.

    If not, could, please show me another solution?

    Forgive my bad English.

    Thanks!
    Last edited by ljtfreitas; Mar 15th, 2012, 10:50 AM.

  • #2
    And how isn't that covered by session, request scoped beans?

    Disclaimer:
    As a note I really disliked the way injection works in JBoss Seam (reinjected each time when needed) but I'm probably biased by all my spring knowledge (or spring way of thinking).

    Comment


    • #3
      Thanks for the reply.

      Personally, I see value in how Seam Injection is dynamic, because there are cases where it is necessary to reinject a smaller scope bean in a bean of wider scope.

      That is my question / problem / issue, the injection of objects with shorter life, in other longer-lived objects.

      Today I found this excerpt from the Spring documentation:

      http://static.springsource.org/sprin...ther-injection

      This use of AOP would be equivalent to the injection dynamics in the Spring? I did not know this feature, and is apparently a solution.

      (By the way, I also love Spring!)

      Again, forgive my poor English.

      Thanks!

      Comment


      • #4
        This use of AOP would be equivalent to the injection dynamics in the Spring? I did not know this feature, and is apparently a solution.
        That is indeed the solution. It looks like if the normal object is injected but actually it is a proxy which operates on the actual scoped object (or first creates it when needed).

        Comment


        • #5
          This use of AOP would be equivalent to the injection dynamics in the Spring? I did not know this feature, and is apparently a solution.
          That is indeed the solution. It looks like if the normal object is injected but actually it is a proxy which operates on the actual scoped object (or first creates it when needed).

          Comment


          • #6
            I will try. It is a very elegant feature ... Spring is great!

            Thanks!

            Comment

            Working...
            X