bean wiring in Spring framework

cofactor
cofactor used Ask the Experts™
on
what is bean wiring in Spring framework ? Could you please explain a bit.

Any example please.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010

Commented:

Author

Commented:
Buddy, I have read that already . But I don't understand the concept . Please explain
its written as ...

Combining together beans within the Spring container is known as bean wiring or wiring. When wiring beans, you should tell the container what beans are needed and how the container should use dependency injection to tie them together. '
How do we combine beans ?  I need example .  How do we do the bean wiring ?
Top Expert 2010

Commented:
See the below Example, you will be surprised!

http://www.javalobby.org/java/forums/t18396.html

Best Regards.
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

before that you must know the
singleton and prototype define of beans in spring ... this is the main concept here !

<bean id="check1" class="">
    <property value="check2" />
</bean>

<bean id="check2".........

this is you have defined the dispatcher-servlet xml file

check1,cheak2 are beans , you defined the check2 bean as property of check1 bean od this is combination of beans

Author

Commented:
>dispatcher-servlet xml
did you mean the Spring configuration file ?
^^ Yes the dispatcher-servlet.xml is none other than spring cfg file.

Wiring :

In traditional programming ,creating associations between objects lead to code that is difficult to reuse and unit-test, and these objects are usually highly coupled to each-other making them hard to reuse and unit test, and they are doing more work than they should making them less cohesive.In spring components are not responsible for managing associations with other components. Instead they are given references to collaborating components by the container. The act of creating these associations between applications is called wiring.
You got that?

Refer this if you still have any doubt :

http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-dependencies
yes your correct !!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial