Announcement Announcement Module
Collapse
No announcement yet.
Multiple "inheritance" (initialzation) of dependencies for bean definitions. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple "inheritance" (initialzation) of dependencies for bean definitions.

    In my project I need something like multiple inheritance (better to say inheritance of dependencies) for bean definitions. Of course, it is clear that multiple inheritance is not a very good way to solve some problems and is anti-pattern, but ...

    There is an inheritance of such bean definitions:
    Abstract1 is parent for Abstract2
    Abstract2 is parent for Abstract3
    This definitions have some dependencies those are initialized.

    And we have also such structure.
    Concrete1 is parent for Concrete2 and Concrete1 has also some identical dependencies as in Abstract1
    Concrete2 is parent for Concrete3 and Concrete2 has also some identical dependencies as in Abstract3
    Concrete3 has also some identical dependencies as Abstarct3.

    In real world for Abstarct1 and Concrete1 is used same Class, and it is also true for Abstarct2 and Concrete2, Abstarct3 and Concrete3.

    The problem:
    I can define only one parent, but for example for Concrete3 it will be great to have all dependencies form Abstract 3 overridden by defined in Concrete2.

    Is there any possibility to implement with Spring (standard way or it is possible to create some special extension)?

    Could anyone help me?

    Thanks in advance.

    P.s. Sorry, if I duplicate this question.

  • #2
    Have a look at Bean definition inheritance.

    Comment


    • #3
      Originally posted by rishishehrawat View Post
      Have a look at Bean definition inheritance.
      Please, send detailed info, where in Spring documentation I can find such a description

      Comment


      • #4
        http://static.springsource.org/sprin...an-definitions

        Comment


        • #5
          - thanks but my question is a little bit different.
          I am not asking how to implement inheritance for bean definitions, I am asking how can I provide for one bean defintion several "parents", which help to initialize all dependencies, those are present in both parents (of course some will be overidden). So one parent is great, but I need at least two .

          Comment

          Working...
          X