Up vote 5 down vote favorite 2 share g+ share fb share tw.
Little confused, the basic spring mvc app has this: app-config. Xml and the mvc-config. Xml has: Do you really need both?
For component-scan, does this mean if I don't put the correct package path my @Controller and @Service markers will have no effect? If I need more than one package, do I just duplicate the entry? I tried using just the mvc:annotation-driven but that didn't work, I had to put com.example.web.
Controllers in the component-scan xml node to make it work. Spring spring-mvc annotations link|improve this question asked Jul 1 '10 at 1:34Blankman13.3k2498255 60% accept rate.
Context:component-scan is clear Scans the classpath for annotated components that will be auto-registered as Spring beans. By default, the Spring-provided @Component, @Repository, @Service, and @Controller stereotypes will be detected. So @Controller is just a Spring bean.
Nothing else. And mvc:annotation-driven registers the HandlerMapping and HandlerAdapter required to dispatch requests to your @Controllers Which is similar to If I need more than one package, do I just duplicate the entry? You can if you want.
Context:component-scan is just a bean post-processor. Or Use a comma-separated list of packages to scan for annotated components.
1 Just for curiosity: context:component-scan includes AutowiredAnnotationBeanPostProcessor and CommonAnnotationBeanPostProcessor which means means that the two components are autodetected and wired together - all without any bean configuration metadata provided in XML – Arthur Ronald F D Garcia Jul 1 '10 at 3:11 Thanks, I didn't want to do br.com. App since it will be scanning potentially more classes than required. Great answer!
Btw what's the diff between a @component and @service? – Blankman Jul 1 '10 at 4:02 @Blankman None. @Service is also a @Component annotation.
See here: static.springsource.org/spring/docs/2.5.6/api/org/… It is just a special metadata to denote a service component in the service layer. – Arthur Ronald F D Garcia Jul 1 '10 at 4:10.
Mvc:annotation-driven allows you to configure behavior of Spring MVC. See details in documentation . For basic usage of Spring MVC you do not need it.
If you need more than one package just mention parent one.
– Blankman Jul 1 '10 at 2:26 No, mvc:annotation-driven allows you to configure behavior of Spring MVC. See details in documentation static.springsource.org/spring/docs/3.0.... For basic usage of Spring MVC you do not need it. – uthark Jul 1 '10 at 2:32.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.