java - Neo4j with Spring: No bean named 'getSessionFactory' available -
i'm new neo4j , spring in combination , spring @ all. when start debugging, following exception:
exception in thread "main" org.springframework.beans.factory.nosuchbeandefinitionexception: no bean named 'getsessionfactory' available
can me please?
apllication-context.xml:
<?xml version="1.0" encoding="utf-8" standalone="no"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:neo4j="http://www.springframework.org/schema/data/neo4j" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/data/neo4j http://www.springframework.org/schema/data/neo4j/spring-neo4j.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <context:component-scan base-package="de.unileipzig.analyzewikipedia.neo4j" /> <!--neo4j:config storedirectory="c:/temp/neo4jdatabase" base-package="de.unileipzig.analyzewikipedia.neo4j.dataobjects"/--> <neo4j:repositories base-package="de.unileipzig.analyzewikipedia.neo4j.repositories"/> <tx:annotation-driven /> <bean id="graphdatabaseservice" class="org.springframework.data.neo4j.support.graphdatabaseservicefactorybean" destroy-method="shutdown" scope="singleton"> <constructor-arg value="c:/develop/uni/analyze-wikipedia-netbeans/database"/> <constructor-arg> <map> <entry key="allow_store_upgrade" value="true"/> </map> </constructor-arg> </bean> </beans>
startup-class
package de.unileipzig.analyzewikipedia.neo4j.console;
import de.unileipzig.analyzewikipedia.neo4j.dataobjects.article; import de.unileipzig.analyzewikipedia.neo4j.service.articleservice; import java.io.file; import org.springframework.context.applicationcontext; import org.springframework.context.support.classpathxmlapplicationcontext; public class neo4jconsole { /** * main: start java file * * @param args string array */ public static void main(string[] args) { string cwd = (new file(".")).getabsolutepath(); applicationcontext context = new classpathxmlapplicationcontext("application-context.xml"); articleservice service = (articleservice) context.getbean("articleservice"); article art = createarticle(); createarticle(service, art); system.out.println("article created"); } private static article createarticle() { article article = new article(); article.settitle("title"); return article; } private static article createarticle(articleservice service, article art) { return service.create(art); } }
thank you.
do have configuration?
@configuration @enableneo4jrepositories("org.neo4j.cineasts.repository") @enabletransactionmanagement @componentscan("org.neo4j.cineasts") public class persistencecontext extends neo4jconfiguration { @override public sessionfactory getsessionfactory() { return new sessionfactory("org.neo4j.cineasts.domain"); } }
for more information, try here
wiki
Comments
Post a Comment