Results 1 to 2 of 2

Thread: JavaConfig for <context:component-scan>

  1. #1

    Default JavaConfig for <context:component-scan>

    So far I have this tag in my XML config file:
    <context:component-scan base-package="de.hska"/>

    I'm doing most of the configuration via JavaConfig in Spring 3.0. Therefore, I'd like to get rid of the component-scan in XML and do it via JavaConfig. Any hint is appreciated!

    My web application uses JSF 2 for the presentation layer, and in web.xml I have the following section.
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:/META-INF/spring.xml</param-value>
    </context-param>
    <listener>
    <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
    </listener>
    <listener>
    <listener-class>org.springframework.web.context.request.Requ estContextListener</listener-class>
    </listener>

  2. #2
    Join Date
    Apr 2007
    Posts
    307

    Default

    You may use AnnotationConfigWebApplicationContext for this purpose.

    Set a "contextClass" init-param with param-value of org.springframework.web.context.support.Annotation ConfigWebApplicationContext.

    The value of "contextConfigLocation" may be fully-qualified @Configuration class names and/or fully-qualified base packages to scan.

    See http://static.springsource.org/sprin...-container-web for a more complete example.
    Chris Beams
    Spring Framework committer, VMware
    http://github.com/cbeams

Posting Permissions

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