Results 1 to 5 of 5

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

  1. #1
    Join Date
    May 2011
    Posts
    3

    Post 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. #2
    Join Date
    May 2011
    Location
    New Delhi, India
    Posts
    157

    Default

    Have a look at Bean definition inheritance.

  3. #3
    Join Date
    May 2011
    Posts
    3

    Default

    Quote 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

  4. #4
    Join Date
    May 2011
    Location
    New Delhi, India
    Posts
    157

  5. #5
    Join Date
    May 2011
    Posts
    3

    Default

    Quote Originally Posted by rishishehrawat View Post
    - 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 .

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •