Get all updates of Java4s
Follow Us: Email Newsletter

Example On Spring Autowiring by Autodetect

Spring » On Feb 8, 2012 { 5 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 Author ♦

Java4s_Author
sivateja@java4s.com
Full Stack( Java/J2EE & UI/UX ) Developer and founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog. Sign-up for the Email Newsletter for your daily dose of Java tutorials.

Comments

5 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.

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
What would you like to learn today?
Browse these popular technologies
Hibernate spring struts Servlets ajax Log4j jQuery Json Core Java Web Services AngularJs
Most Recent Tutorials
Hibernate_Logo Hibernate Recent Posts Spring_Logo Spring Recent Posts Struts_Logo Struts Recent Posts
Useful Links Current & UpComing Tutorials
Upcoming
  Web Services [ SOAP ], JSP
Contact | About Us | Privacy Policy | Advertise With Us

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