benefit of @Autowired annotation in Java

后端 未结 4 1775
庸人自扰
庸人自扰 2021-02-14 01:01

Maybe, because of my wrong English, I couldn\'t understand the benefit of using @Autowired annotation.

According to the tutorial we can simplify the first(I.) case to se

4条回答
  •  半阙折子戏
    2021-02-14 01:55

    When the server bootstraps itself. It finds

     
    

    in the application context and then goes through the classes defined in the contexts. If there are any beans that are autowired, it injects that into the class by referring the context file.

    Basically, it promotes convention over configuration. That's what most frameworks do these days to reduce the development time.

提交回复
热议问题