Announcement Announcement Module
Collapse
No announcement yet.
Autowiring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    There is no difference essentially, just personal preference.

    Comment


    • #3
      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?

      Comment

      Working...
      X