Results 1 to 3 of 3

Thread: Autowiring

  1. #1
    Join Date
    Aug 2012
    Posts
    104

    Default Autowiring

    I did not find it clear from the docs, so I raise the question here (hope this is the right place):

    what is the difference between

    Code:
    	@Autowired
    	private MyObj obj;
    and

    Code:
    	private MyObj obj;
    
    	@Autowired
    	public void setObj(MyObj obj)
    	{
    		this.obj= obj;
    	}

  2. #2
    Join Date
    Oct 2012
    Location
    Shenzhen, China
    Posts
    13

    Default

    There is no difference essentially, just personal preference.

  3. #3
    Join Date
    Aug 2012
    Posts
    104

    Default

    Quote Originally Posted by sumlight View Post
    There is no difference essentially, just personal preference.
    thanks.
    Is there a case where the 1st example will work and the 2nd might fail? or vice-versa?

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
  •