Announcement Announcement Module
Collapse

JavaConfig forum decommissioned in favor of Core Container

As described at

http://static.springsource.org/sprin...fig/README.TXT

key features of the Spring JavaConfig project have been migrated into the core Spring Framework as of version 3.0.

Please see the Spring 3.0 documentation on @Configuration and @Bean support:

http://static.springsource.org/sprin...tml#beans-java

For any questions related to @Configuration classes and @Bean methods in Spring 3.0, please post in the dedicated 'Core Container' forum at

http://forum.springsource.org/forumdisplay.php?f=26
See more
See less
JavaConfig for <context:component-scan> Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment

    Working...
    X