我有与Spring data neo4j一起工作的Spring服务,我决定将Spring data neo4j从2.2更新到当前版本-3.1.4。释放。所以第一次我更新了neo4j,项目失败了,我更新了Spring版本,不同的版本有不同的例外。这个服务包括在我的前端,我叫它是从网络。所以我不知道什么是最佳配置???配置与maven。这里有pom.xml
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.0.2.GA</version>
</dependency>
<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.transaction</artifactId>
<version>3.2.1.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.aop</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.core</artifactId>
</exclusion>
</exclusions>
</dependency>-->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<!-- <version>3.0.2.BUILD-SNAPSHOT</version>-->
<version>3.1.4.RELEASE</version>
<!-- <exclusions>
<exclusion>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</exclusion>
</exclusions>-->
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j-aspects</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j-rest</artifactId>
<version>3.1.4.RELEASE</version>
<!-- <type>test-jar</type>
<scope>test</scope>-->
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>sitemesh</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<!-- Spring framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.2.13.RELEASE</version>
</dependency>-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument-tomcat</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test-mvc</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<scope>test</scope>
</dependency>-->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>net.sourceforge.cglib</groupId>
<artifactId>com.springsource.net.sf.cglib</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>0.4.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.5</version>
</dependency>
<dependency>
<groupId>rome</groupId>
<artifactId>rome</artifactId>
<version>0.9</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>10.0.1</version>
</dependency>
</dependencies>
Spring配置文件
@Configuration
//@EnableScheduling
//@EnableAsync
@ComponentScan(basePackages = {"com.backend"}, excludeFilters = {
@ComponentScan.Filter(Configuration.class)})
//@ImportResource("classpath:META-INF/spring/spring-data-context.xml")
@EnableTransactionManagement
@EnableMBeanExport
@EnableWebMvc
@EnableNeo4jRepositories(basePackages = "com.backend")
public class MainConfig extends Neo4jConfiguration {
private static final String DB_PATH = "C:/neo4j/db/neo/graph.db";
// private GraphDatabaseFactory graphDbFactory;
//private GraphDatabaseService databaseService;
public MainConfig() {
setBasePackage("com.backend");
}
@Bean(destroyMethod = "shutdown")
public GraphDatabaseService graphDatabaseService() {
//graphDbFactory = new GraphDatabaseFactory();
//databaseService = graphDbFactory.newEmbeddedDatabase(DB_PATH);
return new GraphDatabaseFactory().newEmbeddedDatabase(DB_PATH);
// return databaseService;
}
所以每次加载db例外,不了解存储库......
谁知道我应该使用哪个版本的Spring和Spring数据neo4j?此外,它不是从控制台使用,Spring服务是使用SDN从Web调用。
非常感谢。
2天我测试了所有版本,最后我有mavenpom.xml这是支持Spring4.0.7和Spring数据neo4j 3.2.1。释放,我创建了分离的项目jar,它包含在jsf前端和从jsf Bean调用的Spring服务中。这里是一个pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>neo4j-backend</groupId>
<artifactId>neo4jsdn</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<!-- General -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Plugin Versions -->
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
<maven-dependency-plugin.version>2.8</maven-dependency-plugin.version>
<maven-surefire-plugin.version>2.16</maven-surefire-plugin.version>
<!-- Dependency versions -->
<slf4j.version>1.7.5</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.11</junit.version>
<java.source.level>1.7</java.source.level>
<java.target.level>1.7</java.target.level>
<neo4j.version>2.1.5</neo4j.version>
<neo4j.springdata.version>3.2.1.RELEASE</neo4j.springdata.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<aspectj-maven-plugin.version>1.4</aspectj-maven-plugin.version>
<aspectj.version>1.7.4</aspectj.version>
<hibernate-jpa-2.0-api.version>1.0.0.Final</hibernate-jpa-2.0-api.version>
<hibernate-validator.version>4.2.0.Final</hibernate-validator.version>
<spring.version>4.0.7.RELEASE</spring.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<name>neo4jsdn</name>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>1.9.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument-tomcat</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- SDN for advanced mapping mode -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j-aspects</artifactId>
<version>${neo4j.springdata.version}</version>
</dependency>
<!-- Hibernate implementation of the JSR-303 Bean Validation Spec API.
(SDN makes use of the javax.validation:validation-api dependency and
hibernate provides a concrete implementation -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version>
</dependency>
<!-- Logging Related dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- The bulk of our code when sets up and works SDN over is actually in test classes
so include additional dependencies required to make this work in the tests -->
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-kernel</artifactId>
<version>${neo4j.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<!-- JPA annotations for spring-aspects compilation which uses @Transactional -->
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>${hibernate-jpa-2.0-api.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- https://jira.springsource.org/browse/SPR-6819 -->
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Advanced mapping uses AspectJ for build-time aspect weaving.
It is thus necessary to hook the AspectJ Maven plugin into the build process
as per the config below -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${aspectj-maven-plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<outxml>true</outxml>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
<aspectLibrary>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
<source>${java.source.level}</source>
<target>${java.target.level}</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<url>http://repo.springsource.org/libs-milestone/</url>
</repository>
<repository>
<id>repo.springsource.org.release</id>
<name>Spring Framework Maven Release Repository</name>
<url>http://repo.springsource.org/release</url>
</repository>
<repository>
<id>repo.neo4j.org.releases</id>
<name>Neo4j Releases Repository</name>
<url>http://m2.neo4j.org/content/repositories/releases</url>
</repository>
<repository>
<id>spring-libs-milestone-local</id>
<name>Spring Milestones</name>
<url>http://repo.springsource.org/libs-milestone-local</url>
</repository>
</repositories>
</project>
配置文件
@Configuration
@ComponentScan(basePackages = {"com"}, excludeFilters = {
@ComponentScan.Filter(Configuration.class)})
@ImportResource("classpath:META-INF/spring/application-context.xml")
@EnableTransactionManagement(mode = AdviceMode.ASPECTJ)
@EnableMBeanExport
@EnableNeo4jRepositories(basePackages = "com")
public class Application extends Neo4jConfiguration {
public Application() {
setBasePackage("com");
}
@Bean
public GraphDatabaseService graphDatabaseService() {
return new GraphDatabaseFactory().newEmbeddedDatabase("C:/neo4j/db/userdata.db");
}
Spring服务
@Service
@Component
@Transactional
@Qualifier("userService")
public class UserService {
@Autowired
private Neo4jTemplate template;
@Autowired
private UserRepository userRepository;
@Transactional
public User createUserNode(User user) {
return userRepository.save(user);
}
public List<User> getAllUsers() {
List<User> allList = new ArrayList<User>();
Iterable<User> users = template.findAll(User.class);
if (users != null) {
for (User u : users) {
allList.add(u);
}
}
return allList;
}
关于最新的和我的测试失败了以下NPE(几天前一切正常,我的代码没有一行没有被更改): 我的代码: 这个问题的原因是什么?如何解决它?
当我试图更新我的项目JAR以与新版本的neo4j服务器兼容时,我正在使用neo4j 2.1.2服务器我遇到了问题。 这是porm.xml中使用的旧版本配置 这是新的: 但是当我试图编译我的应用程序时,我得到了这样的跟踪跟踪:
是否有人拥有使用GrailsV3的SpringDataNeo4j(3.3.0)并愿意共享配置? 我想让Web界面工作(按这里:如何启用neo4j webadmin时使用sping-data-neo4j?),但我有点失去了当试图找出什么应该去,作为Grails从扩展它,所示示例从扩展它。
我试图编写一个返回大量数据(200个节点)的查询。节点非常简单: 我最初使用Spring Data Neo4j模板接口,但在返回大约100个节点后发现它非常慢。 所以,我的问题是:是否有一种方法可以提供标签作为Cypher查询的一部分,以防止需要再次查询每个节点?或者,除此之外,是否有一种方法可以为SDN提供一个包含标签和属性的并将其转换为POJO? 注意:我意识到SDN团队正在未来的版本中完全使
你好,我有一个Spring Boot应用程序,正在使用 这取决于泽西版本2.7。 当试图使用 在内部使用泽西版本1.1时,应用程序会失败,因为同一个库有两个不同的版本。 任何关于如何解决这个问题的建议,我都试图只使用2.7版,但它们似乎彼此不兼容 谢谢 java.lang.NoSuchMultiodError:javax.ws.rs.core.pplication.get属性()Ljava/uti
我正在使用数据库和。现在,我想导入相当大的数据集,因此我研究了的批插入功能。 经过我的研究,我发现: 用于嵌入式数据库:http://docs.neo4j.org/chunked/stable/batchinsert.html以及使用它的Michael Hunger项目:https://github.com/jexp/batch-import/ REST批处理终结点:http://docs.neo