Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0.1
-
Fix Version/s: 2.0.2
-
Component/s: Documentation
-
Labels:None
Description
From http://www.nabble.com/AppFuse-2.0.1---Error-while-testing-the-tutorial-jpa-module-from-appfuse-demos-to14254631s2369.html#a14254631:
I tried the tutorial-jpa module from appfuse-demos. If you run mvn test -Dtest=PersonDaoTest you get the following error message:
-------------------------------------------------------------------------------
Test set: org.appfuse.tutorial.dao.PersonDaoTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.444 sec <<< FAILURE!
testFindPersonByLastName(org.appfuse.tutorial.dao.PersonDaoTest) Time elapsed: 0.401 sec <<<
ERROR!
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean
with name 'org.appfuse.tutorial.dao.PersonDaoTest': Unsatisfied dependency expressed
through bean property 'personDao': Set this property value or disable dependency
checking for this bean.
I only can avoid it if I move the <bean id="personDao" class="org.appfuse.tutorial.dao.jpa.PersonDaoJpa"/> entry from src/main/webapp/WEB-INF/applicationContext.xml to src/main/resources/applicationContext-resources.xml.
If this is the only way to do it then it would be an error in your tutorial, because you mention explicitely that src/main/webapp/WEB-INF/applicationContext.xml is the prefered location if you have a base archetype.
I tried the tutorial-jpa module from appfuse-demos. If you run mvn test -Dtest=PersonDaoTest you get the following error message:
-------------------------------------------------------------------------------
Test set: org.appfuse.tutorial.dao.PersonDaoTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.444 sec <<< FAILURE!
testFindPersonByLastName(org.appfuse.tutorial.dao.PersonDaoTest) Time elapsed: 0.401 sec <<<
ERROR!
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean
with name 'org.appfuse.tutorial.dao.PersonDaoTest': Unsatisfied dependency expressed
through bean property 'personDao': Set this property value or disable dependency
checking for this bean.
I only can avoid it if I move the <bean id="personDao" class="org.appfuse.tutorial.dao.jpa.PersonDaoJpa"/> entry from src/main/webapp/WEB-INF/applicationContext.xml to src/main/resources/applicationContext-resources.xml.
If this is the only way to do it then it would be an error in your tutorial, because you mention explicitely that src/main/webapp/WEB-INF/applicationContext.xml is the prefered location if you have a base archetype.
While running a test, the context path for Spring are set to
AbstractSingleSpringContextTests.loadContextLocations(210) | Loading context for locations: classpath:/applicationContext-resources.xml,classpath:/applicationContext-dao.xml,classpath*:/applicationContext.xml,classpath:**/applicationContext*.xml
Maybe , the applicationContext.xml in the WEB-INF directory is not present in the path.
As of now, I am using applicationContext-resources for my spring DI