Announcement Announcement Module
Collapse
No announcement yet.
Xml replcement for @Configurable annotation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Xml replcement for @Configurable annotation

    Hello

    I am java developer and I use your framework "Spring"
    in my application. I have a problem and I have not found
    clear answer on Spring official documentation and on any forum.

    Problem description.

    We have two classes:

    public class A {
    ...
    ...
    }


    public class B {
    private A a;

    public void setA(A a) {
    this.a = a;
    }

    ....
    ....
    }


    I want use dependency injection mechanism form Spring and inject class A to B when B is created.
    Class B is not managed by Spring, when I create class "B" I use "new" operator, I looked to Spring
    documentation and I have found "@Configurable" and AspectJ solution, it all work when I have access to
    source code of class B and I can put annotation

    @Configurable
    public class B {
    ....
    ....
    }

    My problem is, I don't have access to source code of class B (let say it comes from some outside library)
    and I can't put annotation @Configurable. Can I replace @Configurable by some XML definition in xml configuration
    file. I haven't found answer for that in Spring documentation (only @Configurable annotation example)

    Best Regards
    Kamil Ratajczak.

  • #2
    We are currently in the process of moving to stackoverflow.com for our forums. If you're still having this issue please consider asking it again at http://stackoverflow.com using the #spring tag. If you do post it there, please reply here with the link. Thanks!

    Comment

    Working...
    X