Newsletter

Example On Spring Autowiring by Autodetect

Spring » on Feb 8, 2012 { 6 Comments } By Sivateja

Let us see the example on spring Autowiring with autowire as autodetect.  Actually spring autowire=”autodetect” frist will works as Spring Autowiring constructor if not then works as Spring Autowiring byType, byType means setter injection right hope you remember :-)  well will see the example..

Example On Spring Autowiring autodetect

Files required…

  • ClientLogic.java
  • Book.java
  • Categories.java
  • spconfig.xml

Book.java

Categories.java

ClientLogic.java

spconfig.xml

 

You Might Also Like

  ::. About the Author .::

Java4s_Author
- Full Stack Java/J2EE & UI Web Developer
Founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog, Love Java and UI frameworks.
You can sign-up for the Email Newsletter for your daily dose of Java tutorials.

Comments

6 Responses to “Example On Spring Autowiring by Autodetect”
  1. Vineet says:

    Is autowire=”autodetect” is working with Spring 3.0 ??

  2. Manopriya says:

    Can we autowire Collections(Map,list,Set etc)?
    If so, can you please provide a small example.

  3. Hema Kumar says:

    Hi Siva Please check the statement

    Actually spring autowire=”autodetect” frist will works as Spring Autowiring constructor if not then works as Spring Autowiring byType,

    But, it is reverse

    Actually spring autowire=”autodetect” frist will works as Spring Autowiring byType if not then works as Spring Autowiring constructor ,

  4. Stephen says:

    Categories class didn’t contain setter method for Book class. Is it going to work if only constructor for Book is present ?

  5. Phani Kumar Kolla says:

    no, it wont work, there must be both setter and constructor.

  6. Manoohar says:

    It will work …no need to have setter

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
Most Recent Posts from Top Categories
Hibernate Spring Struts
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2018 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.