neo4j(2)Sample project XML Configuration

neo4j(2)SampleprojectXMLConfiguration

1.SpringConfiguration

###############################################

#neo4jdatabase

###############################################

neo4j.store.directory=c://neo4j.db

<?xmlversion="1.0"encoding="UTF-8"?>

<beansxmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:p="http://www.springframework.org/schema/p"

xmlns:tx="http://www.springframework.org/schema/tx"

xmlns:context="http://www.springframework.org/schema/context"

xmlns:jdbc="http://www.springframework.org/schema/jdbc"

xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"

xmlns:util="http://www.springframework.org/schema/util"

xsi:schemaLocation="

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-3.1.xsd

http://www.springframework.org/schema/tx

http://www.springframework.org/schema/tx/spring-tx-3.1.xsd

http://www.springframework.org/schema/context

http://www.springframework.org/schema/context/spring-context-3.1.xsd

http://www.springframework.org/schema/jdbc

http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd

http://www.springframework.org/schema/data/neo4j

http://www.springframework.org/schema/data/neo4j/spring-neo4j-2.0.xsd

http://www.springframework.org/schema/util

http://www.springframework.org/schema/util/spring-util-3.1.xsd">

<neo4j:repositoriesbase-package="com.sillycat.easynosql.dao.neo4j.repository"/>

<neo4j:configstoreDirectory="${neo4j.store.directory}"/>

<beanid="initNeo4jService"class="com.sillycat.easynosql.dao.neo4j.init.InitNeo4jService"init-method="init"/>

</beans>

AndIchangetheannotationforservicelayerto

<!--

<beanid="userService"class="com.sillycat.easynosql.service.impl.UserServiceMongoImpl">

</bean>

<beanid="userService"class="com.sillycat.easynosql.service.impl.UserServiceNeo4jImpl">

</bean>

<beanid="userService"class="com.sillycat.easynosql.service.impl.UserServiceRedisImpl">

</bean>

-->

<beanid="userService"class="com.sillycat.easynosql.service.impl.UserServiceRedisImpl">

</bean>

MakeUserServicetointerface.

2.Myjardependency:

<dependency>

<groupId>org.springframework.data</groupId>

<artifactId>spring-data-neo4j</artifactId>

<version>2.1.0.BUILD-SNAPSHOT</version>

</dependency>

<dependency>

<groupId>org.neo4j</groupId>

<artifactId>neo4j-kernel</artifactId>

<version>${neo4j.kernel.version}</version>

</dependency>

<dependency>

<groupId>org.neo4j</groupId>

<artifactId>neo4j-cypher</artifactId>

<version>${neo4j.cypher.version}</version>

</dependency>

<dependency>

<groupId>org.neo4j</groupId>

<artifactId>neo4j-cypher-dsl</artifactId>

<version>${neo4j.cypher.dsl.version}</version>

</dependency>

<dependency>

<groupId>org.springframework.data</groupId>

<artifactId>spring-data-redis</artifactId>

<version>${spring.data.redis.version}</version>

</dependency>

<properties>

<spring.data.mongodb.version>1.1.0.BUILD-SNAPSHOT</spring.data.mongodb.version>

<spring.core.version>3.1.1.RELEASE</spring.core.version>

<neo4j.kernel.version>1.7</neo4j.kernel.version>

<neo4j.cypher.version>1.7</neo4j.cypher.version>

<neo4j.cypher.dsl.version>1.7</neo4j.cypher.dsl.version>

<spring.data.redis.version>1.0.0.RC1</spring.data.redis.version>

</properties>

Thisisjustsomeinitialideafromonesimpleexample.IthinkIwillstudymoreaboutneo4jlater.

references:

http://krams915.blogspot.com/2012/03/spring-mvc-31-implement-crud-with_8518.html

相关推荐