Results 1 to 5 of 5

Thread: Regarding Contructor-arg

  1. #1
    Join Date
    Aug 2008
    Posts
    2

    Default 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.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Aug 2008
    Posts
    2

    Thumbs down 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

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    I suggest you read the reference guide, it explains that quite clearly how everything works.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    May 2005
    Location
    California, US
    Posts
    735

    Default

    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
  •