java - org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'liferaySessionFactory' is defined -
i try run spring project using junit, wrote beans in file called application-context.xml
! problem appears when run project , program looks beandefinition
variable , finds empty... i'm using filesystemxmlapplicationcontext
define application context , i'm unable loadbeandefinitions
using stuff! after looking on internet found there method called loadbeandefinitions(xmlbeandefinitionreader xmlbeandefinitionreader)
and don't know if 1 can instantiate or not? , how can use it, way? , here code context=new filesystemxmlapplicationcontext(new string[] {"classpath:application-context.xml"}){
@override protected void initbeandefinitionreader(xmlbeandefinitionreader reader) { super.initbeandefinitionreader(reader); reader.loadbeandefinitions("liferay-config.xml"); } };
liferay-config.xml
<bean id="liferaysessionfactory" class="com.liferay.portal.kernel.spring.util.springfactoryutil" factory-method="newbean"> <constructor-arg value="com.liferay.portal.dao.orm.hibernate.portletsessionfactoryimpl" /> <constructor-arg> <map> <entry key="datasource" value-ref="datasource" /> </map> </constructor-arg> </bean>
note: datasource declared in application-context.xml
Comments
Post a Comment