gpt4 book ai didi

java - Spring data neo4j 的 Cineasts 示例的错误

转载 作者:行者123 更新时间:2023-12-01 13:04:08 25 4
gpt4 key购买 nike

我导入了cineast maven项目到eclipse,但我面临配置问题...

cvc-complex-type.4:属性“base-package”必须出现在元素“neo4j:config”上

以下是出现此错误的配置文件。

ApplicationContext.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:annotation-config/>
<context:component-scan base-package="org.neo4j.cineasts">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>

<context:spring-configured/>

<neo4j:config storeDirectory="target/data/graph.db"/>
<neo4j:repositories base-package="org.neo4j.cineasts.repository"/>

<!--neo4j:config graphDatabaseService="graphDatabaseService"/>
<bean id="graphDatabaseService" class="org.springframework.data.neo4j.rest.SpringRestGraphDatabase">
<constructor-arg value="http://localhost:7474"/>
</bean-->

<bean class="org.neo4j.cineasts.movieimport.MovieDbApiClient">
<constructor-arg value="926d2a79e82920b62f03b1cb57e532e6"/>
</bean>
<bean class="org.neo4j.cineasts.movieimport.MovieDbLocalStorage">
<constructor-arg value="data/json"/>
</bean>

<tx:annotation-driven mode="proxy"/>

</beans>

电影测试上下文.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:annotation-config/>
<context:spring-configured/>
<context:component-scan base-package="org.neo4j.cineasts"/>

<neo4j:config graphDatabaseService="graphDatabaseService"/>
<neo4j:repositories base-package="org.neo4j.cineasts.repository"/>

<bean id="graphDatabaseService" class="org.neo4j.test.ImpermanentGraphDatabase" destroy-method="shutdown"/>

<bean class="org.neo4j.cineasts.movieimport.MovieDbApiClient">
<constructor-arg value="926d2a79e82920b62f03b1cb57e532e6"/>
</bean>
<bean class="org.neo4j.cineasts.movieimport.MovieDbLocalStorage">
<constructor-arg value="data/json"/>
</bean>
<tx:annotation-driven mode="proxy"/>
</beans>

最佳答案

看看http://blog.neo4j.org/2014/03/spring-data-neo4j-progress-update-sdn-3.html

这实际上是 Stack 上早期的重复问题,但是,长话短说,如果您使用的是最新的 SDN(我很确定您是),那么您需要包含“base-package” “neo4j:config 和 neo4j:repositories 元素中的属性。

在上面的链接中,Michael Hunger 解释了这一点,您可以清楚地看到这些属性的值应该是什么。

HTH

关于java - Spring data neo4j 的 Cineasts 示例的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23356398/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com