Results 1 to 2 of 2

Thread: Could annotation based and xml based configuration be used together in spring 2.5?

  1. #1
    Join Date
    Aug 2010
    Posts
    28

    Default Could annotation based and xml based configuration be used together in spring 2.5?

    Hi

    I've been working on a project where controllers have been written extending Controller classes. Could I configure and use the POJO based Controllers as well (using @Controller) in the same application?

    Many thanks

  2. #2
    Join Date
    Aug 2010
    Posts
    28

    Default Could annotation based and xml based configuration be used together in spring 2.5?

    Many thanks jamestastic, I've got it resolved for now

    Below are the lines needed to to be addeded to the web configuration file to have them working together:
    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"  
           xmlns:context="http://www.springframework.org/schema/context"                    ...line1
           xsi:schemaLocation="http://www.springframework.org/schema/beans 
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd                        
                http://www.springframework.org/schema/context                           ...line2
            http://www.springframework.org/schema/context/spring-context-2.5.xsd">  ...line3
    
    
    
        <context:annotation-config/>   ...line4
    
        <context:component-scan base-package="myPackage"/>  ...line5
    
        <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>  ...line6
    
        <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>   ...line7
    
        <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/>  ...line8
    
    </beans>
    I was too careless to not to add line 8 in my application.

    Many thanks

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •