spring-3

Difference between <context:annotation-config> and <context:component-scan>

纵饮孤独 提交于 2019-11-26 03:13:51
问题 I\'m learning Spring 3 and I don\'t seem to grasp the functionality behind <context:annotation-config> and <context:component-scan> . From what I\'ve read they seem to handle different annotations ( @Required , @Autowired etc vs @Component , @Repository , @Service etc), but also from what I\'ve read they register the same bean post processor classes. To confuse me even more, there is an annotation-config attribute on <context:component-scan> . Can someone shed some light on these tags? What\

Understanding Spring @Autowired usage

ⅰ亾dé卋堺 提交于 2019-11-26 00:07:13
问题 I am reading the spring 3.0.x reference documentation to understand Spring Autowired annotation: 3.9.2 @Autowired and @Inject I am not able to understand the below examples. Do we need to do something in the XML for it to work? EXAMPLE 1 public class SimpleMovieLister { private MovieFinder movieFinder; @Autowired public void setMovieFinder(MovieFinder movieFinder) { this.movieFinder = movieFinder; } // ... } EXAMPLE 2 public class MovieRecommender { private MovieCatalog movieCatalog; private