-
Aug 14th, 2008, 07:09 AM
#1
Regarding Contructor-arg
I am very new to spring MVC. Recently i have downloaded the spring security sample and was working on that. The sample defines a Controller "bank" and the corresponding bank-servlet.xml has the following entries
<?xml version="1.0" encoding="UTF-8" ?>
-- <bean name="/listAccounts.html" class="bigbank.web.ListAccounts">
<constructor-arg ref="bankService" />
</bean>
- <bean name="/post.html" class="bigbank.web.PostAccounts">
<constructor-arg ref="bankService" />
</bean>
- <bean id="viewResolver" class="org.springframework.web.servlet.view.Intern alResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
So far I understand the contructor-arg refer to a bean name bankService. But I dont find any definition of the bean bankervice in the configuraton file. Please tell me, what is wrong in my understanding.
Thanks.
-
Aug 14th, 2008, 09:10 AM
#2
When posting please use [ code][/code ] tags.
There is a hierarchy between application contexts. The bankService is loaded in the ROOT application context (which is loaded by the ContextLoaderListener). The DispatcherServlet named bank uses that as a parent context.
-
Aug 14th, 2008, 10:06 AM
#3
root context
>When posting please use [ code][/code ] tags.
Thanks for the advice
>There is a hierarchy between application contexts. The bankService is loaded in the ROOT application context (which is loaded by the ContextLoaderListener). The DispatcherServlet named bank uses that as a parent context.
How does the Root application context know which class to be loaded as bankservice.
Thanks again for the help
-
Aug 14th, 2008, 03:52 PM
#4
I suggest you read the reference guide, it explains that quite clearly how everything works.
-
Aug 15th, 2008, 11:47 AM
#5
Instead of trying to first climb the Mount Everest that is Spring Security, first climb Mount Annapurna that is the Spring Framework. For example, write a simple web form app that doesn't use Spring Security.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules