Results 1 to 9 of 9

Thread: Component Scan Base Package to multiple paths

Hybrid View

  1. #1

    Lightbulb Component Scan Base Package to multiple paths

    Hello, here I have problem that is getting me :

    If I define the component-scan context defined like this
    PHP Code:
        <context:component-scan  base-package="com.transporte.mbean, com.transporte.persistencia.dao"/> 
    won't work any of both(com.transporte.mbean or com.transporte.persistencia.dao) they are not injected but if I do this

    PHP Code:
        <context:component-scan  base-package="com.transporte.mbean"/> 
    the injected definition hasm an instance, but I need to resolve the daos annotations classes too, snif

    For eg: im using a backBeanUser injected to be used un a jsf page, and a serviceUserLogin is injected in this backBeanUser, i can't make them both work together(only the first one works)

    Does someone know how can I solve this? I don't know hoew to proceed???
    Last edited by guillermodl; Jan 28th, 2008 at 09:57 PM.

  2. #2

    Default

    I was thinking maybe there's a way to associate a point-cut to component-scan, something like this
    "execution(* com.transporte.*.*(..))"
    help!!!

  3. #3

    Default

    problem solved using arid framework

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

    Default

    Why not simply define 2 component-scan blocks?

    Code:
    <context:component-scan base-package="com.transporte.mbean"/>
    <context:component-scan base-package="com.transporte.persistencia.dao"/>
    of using the include and exclude features...

    Code:
    <context:component-scan  base-package="com.transporte">
      <context:include-filter type="aspectj" expression="com.transporte.*.*" />
    </context:component-scan>
    I suggest you read the desired chapter in the reference guide, it is clearly explained in there what you can do.
    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
    Oct 2009
    Location
    Czech Republic
    Posts
    29

    Default

    Hi.

    I spent some time trying to understand how component-scan and annotation-config work.

    I think it should be highlighted in the reference, that

    1. There can be more than one component-scan elements!

    2. The component-scan element automatically turns on the annotation-config option!

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

    Default

    # The component-scan element automatically turns on the annotation-config option!
    the documentation

    Furthermore, the AutowiredAnnotationBeanPostProcessor and CommonAnnotationBeanPostProcessor are both included implicitly when using the component-scan element. That means that the two components are autodetected and wired together - all without any bean configuration metadata provided in XML.
    The first one isn't mentioned explicitly but is it really needed. If you think so register a JIRA instead of dumping it here.
    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

  7. #7
    Join Date
    Jan 2012
    Posts
    7

    Question

    wt if i have this
    Code:
    <context:component-scan base-package="com.ent.proy.service.component">
            <context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>
    </context:component-scan>
    and not

    Code:
    <context:include-filter type="aspectj" expression="com.transporte.*.*" />

  8. #8

    Default

    problem solved using arid framework
    Free ebook download 100 % direct link at http://ebook12.com

Posting Permissions

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