2
App
|-src
    |-com
        |-xx
            |-model
                |-IclassA.java
                    |-impl
                        |-ClassA.java
|-test
    |-com
        |-xx
            |-model
                |-Conf.java
                    |-impl
                        |-ClassATest.java

i have an XML file for the productions and a java conf file for the tests

In the Conf.java i have a bean deceleration for ClassA and i'm using it in the test as

 @ContextConfiguration(classes = Conf.class)

In the xml i have <context:component-scan base-package="com.xx.*" /> , the problem is that this scan is scanning the test folder as well and recognize like i have 2 deceleration of ClassA, one in the XML and one in the Conf.java file.

Is there away to exclude the scan for the test folder?

USer22999299
  • 5,284
  • 9
  • 46
  • 78

1 Answers1

1

Try to use context:exclude-filter

<context:component-scan base-package="com.xx.*">
    <context:exclude-filter type="regex" expression="**.*Test"/>
 </context:component-scan>
Jens
  • 67,715
  • 15
  • 98
  • 113