1

Initially I built a Maven-Spring application with test cases. It worked well and all tests did pass. But now I have a separate maven project for tests and moved the test classes and the spring xml configuration files that project. I have added the main spring project as dependency.

I suppose the test project doesn't load the list of values defined in "packagesToScan" property in db-context.xml. Could anyone please help me find the error?

<!-- Entity Manager -->
<bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="persistenceUnitName" value="m-entrevista" />
    <property name="packagesToScan">
        <list>
             <value>{com.packagename}</value>
        </list>
    </property>
</bean>

The project structure looks like this.
Spring test project

enter image description here

Main spring project

enter image description here

When I run a test, it throws an IllegalArgumentException.

enter image description here

kk-dev11
  • 2,654
  • 5
  • 37
  • 48

1 Answers1

0

It was Persistence.xml which triggered the exception. Initially I had the persistence.xml in my test project. As soon as I moved it into Main Spring Persistece project, where I have JPA Entities, all tests ran without any errors.

kk-dev11
  • 2,654
  • 5
  • 37
  • 48