Quick question.
Can you reference Spring classes in the applicationContext.xml, when they are in another jar which you webApp uses?
The JAR (a common jar that contains all my servries and daos etc) is in the WAR file, but when I try to reference a service through the applicationContext.xml, I get the following error:-
Error creating bean with name 'com.myproject.common.test.impl.TestServiceImpl' defined in ServletContext resource [/WEB-INF/context/spring-context.xml]: Instantiation of bean failed; nested exception is java.lang.IllegalStateException: No bean class specified on bean definition
(Note spring-context.xml is imported into the applicationContext.xml without error.)
My context XML:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="com.myproject.common.test.impl.TestServiceImpl">
<property name="genericDao" ref="genericDao" />
</bean>
</beans>
My App packages are all under com.myproject.web
My common JARS all under com.myproect.common
Your bean element needs a class attribute:
The id attribute is just an identifier for the referencing the bean elsewhere in the bean files. The class attribute supplies the name of the class the bean represents.