0
我正在開發一個使用Spring和Neo4j作爲數據庫的RESTful Web服務。我在Windows 7系統上安裝了Neo4j 3.0.7。我能夠在我的Spring配置中使用以下行來開發CRUD API:<neo4j:config storeDirectory="C:\demo.graphdb" base-package="test.model"/>
。帶彈簧aplicationContext和外部neo4j服務器的Neo4j配置
現在我要連接的是在localhost:7474
運行,但WAR文件的部署過程中我得到一個異常我現有的Neo4j數據庫:
Configuration problem: Unable to locate Spring NamespaceHandler for
XML schema namespace
[http://www.springframework.org/schema/data/neo4j] Offending resource:
ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]
我的整個Spring的ApplicationContext是:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:neo4j="http://www.springframework.org/schema/data/neo4j" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/data/neo4j http://www.springframework.org/schema/data/neo4j/spring-neo4j.xsd">
<context:component-scan base-package="test.*" />
<context:property-placeholder location="classpath:spring.properties" ignore-unresolvable="true" />
<mvc:annotation-driven />
<mvc:default-servlet-handler />
<bean id="graphDataBaseService" class="org.springframework.data.neo4j.rest.SpringRestGraphDatabase" > <constructor-arg index="0" value="http://localhost:7474" />
<constructor-arg index="1" value="neo4j"/>
<constructor-arg index="2" value="[email protected]"/>
</bean>
<neo4j:config graphDataBaseService="graphDataBaseService" base-package="test.model" />
<neo4j:repositories base-package="test.dao"/>
</beans>
我正在使用:
- Spring Data Neo4j version 4.1.6.RELEASE
- Neo4j的版本3.0.7
- 春WebMvc版本4.1.1.RELEASE
感謝frant.hartm分享這一寶貴的信息。現在我將嘗試進一步進行基於Java的bean配置,如果遇到任何問題,我會繼續發佈。再次感謝。 – sayan