2017-08-22 9 views
0

私はneo4jと春のコンビネーションと春には初めてです。私は、デバッグを開始すると、私は次の例外を取得する:スレッド内春のNeo4j:「getSessionFactory」という名前のBeanはありません

例外 "メイン" org.springframework.beans.factory.NoSuchBeanDefinitionException:名前のない BeanののgetSessionFactory "利用可能

ができ、誰お願い助けて?

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> 

スタートアップクラス

パッケージ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 the java file 
    * 
    * @param args as 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); 
    } 
} 

ありがとうございます。

+0

は、あなたが完全な例外ログを投稿することができます見てみては? –

答えて

0

この設定はありますか?詳細については

@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"); 
    } 
} 

here

+0

ありがとうございます。私はそれを読んでいる間、この部分を見落としました。 –

関連する問題