maven依赖

<!-- Tests -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.2.5.RELEASE</version>
<scope>test</scope>
</dependency> <!--SDN-->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>4.1.0.RELEASE</version>
</dependency> <!--Neo4j-->
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-test</artifactId>
<version>2.1.0</version>
<scope>test</scope>
</dependency> <dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-kernel</artifactId>
<version>3.1.0</version>
</dependency> <dependency>
<groupId>org.neo4j.app</groupId>
<artifactId>neo4j-server</artifactId>
<version>3.1.0</version>
</dependency> <dependency>
<groupId>org.neo4j.test</groupId>
<artifactId>neo4j-harness</artifactId>
<version>3.1.0</version>
<scope>test</scope>
</dependency> <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>

domain model(com.shubo.neo4j.domain)

@NodeEntity
public class Person {
@GraphId
private Long nodeId;
String name;
String from;
String hobbies; public Person(){
} public Person(String name,String from, String hobbies){
this.name = name;
this.from = from;
this.hobbies = hobbies;
} }

repository(com.shubo.neo4j.repositories)

public interface PersonRepository extends GraphRepository<Person> {
}

configuration(ogm.repositories,SDN会自动扫描该文件,以及配置方法的声明和一个使用实例)

@Configuration
@EnableNeo4jRepositories(basePackages = "com.shubo.neo4j.repository")
@EnableTransactionManagement
@ComponentScan("com.shubo.neo4j")
public class MyConfiguration extends Neo4jConfiguration{
@Bean
public SessionFactory getSessionFactory(){
return new SessionFactory("com.shubo.neo4j.domain");
} @Bean
public Session getSession() throws Exception {
return super.getSession();
}
}
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {MyConfiguration.class})
public class Neo4jTest { @Autowired
PersonRepository personRepository; @Test
public void testCRUDPerson(){
System.out.println(personRepository.getClass());
Person person = new Person("Jerry","China","LOL");
personRepository.save(person);
System.out.println("保存成功");
}
}

心态炸了,我再写一个4.1.0版本的SND实例的更多相关文章

  1. 以前写SpringMVC的时候,如果需要访问一个页面,必须要写Controller类,然后再写一个方法跳转到页面,感觉好麻烦,其实重写WebMvcConfigurerAdapter中的addViewControllers方法即可达到效果了

    以前写SpringMVC的时候,如果需要访问一个页面,必须要写Controller类,然后再写一个方法跳转到页面,感觉好麻烦,其实重写WebMvcConfigurerAdapter中的addViewC ...

  2. 表单配置项写法,表单写成JSON数组套对象,一行是一个数组单位,一列是一个对象单位,然后再写一个公共组件读取这个配置,循环加载slot,外层载入slot的自定义部分,比如input select等,这种写法就是把组件嵌套改为配置方式

    表单配置项写法,表单写成JSON数组套对象,一行是一个数组单位,一列是一个对象单位,然后再写一个公共组件读取这个配置,循环加载slot,外层载入slot的自定义部分,比如input select等,这 ...

  3. 在Vue的构造器里我们写一个add方法,然后我们用实例的方法调用它

    html <div id="app"> <div>{{message}}</div> </div> js var vm = new ...

  4. Java基础-接口.编写2个接口:InterfaceA和InterfaceB;在接口InterfaceA中有个方法void printCapitalLetter();在接口InterfaceB中有个方法void printLowercaseLetter();然 后写一个类Print实现接口InterfaceA和InterfaceB,要求 方法 实现输出大写英文字母表的功能,printLowerca

    #34.编写2个接口:InterfaceA和InterfaceB:在接口InterfaceA中有个方法void printCapitalLetter():在接口InterfaceB中有个方法void ...

  5. 自己写一个java的mvc框架吧(二)

    自己写一个mvc框架吧(二) 自己写代码的习惯 写一个框架吧,如果这个框架会用到一些配置上的东西,我自己习惯是先不用考虑这个配置文件应该是怎样的,什么形式的,先用一个java对象(比如叫 Config ...

  6. 自己写一个java的mvc框架吧(一)

    自己写一个mvc框架吧(一) 目录 自己写一个mvc框架吧(一) 自己写一个mvc框架吧(二) 自己写一个mvc框架吧(三) 自己写一个mvc框架吧(四) 写之前的一些废话 废话 1 (总是要先随便说 ...

  7. 用flask写一个简单的接口

    用falsk写一个简单的接口,这个接口的数据本来是爬虫爬取的数据,但是今天只写一个flask接口,数据就用测试数据好了. import random import re import time imp ...

  8. 【SimpleMsgPack.NET】发布一个msgpack协议C#版本的解析开源库

    这两年一直都关注这IOCP在网络通信这方面的应用,当然数据的传递是经常需要的.今年接触了MsgPack格式,发现他用来做传输时数据打包真是太爽了.因为他可以直接打包二进制数据,不需要任何的转换.有人会 ...

  9. 我为什么要再给lua写一个json模块

    最近要给自己编写的服务器加上json解析模块.根据我当前的项目,可以预测服务器中使用json的地方: 通信.由于与客户端通信使用google protocolbuffer,仅在与SDK通信中使用jso ...

随机推荐

  1. 【.NET】无法加载协定为“ServiceReference1.ReportWsSoap”的终结点配置部分,因为找到了该协定的多个终结点配置。请按名称指示首选的终结点配置部分。

    前言 引用websevice时,有时会出现如下错误: 异常详细信息: System.InvalidOperationException: 无法加载协定为“ServiceReference1.Repor ...

  2. 查看自身公网ip的命令

    curl ifconfig.me curl cip.cc curl ipinfo.io

  3. mariadb数据库集群

    1.主从架构: 每个从节点需要一个dump线程连接主节点 异步:效率高,安全性低,有延迟 同步:效率低,安全性高,无延迟 主:可读可写,(dump thread) 从:可读不可写 (sql threa ...

  4. 【Linux开发】linux设备驱动归纳总结(一):内核的相关基础概念

    linux设备驱动归纳总结(一):内核的相关基础概念 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ...

  5. [转帖]浪潮信息最大供应商英特尔(Intel):2018 年采购额 145.76 亿元

    浪潮信息最大供应商英特尔(Intel):2018 年采购额 145.76 亿元 https://t.cj.sina.com.cn/articles/view/3172142827/bd130eeb01 ...

  6. hive与hbase的交互简要示意

    建表 create external table if not exists hive2hbase( id int, ---> 对应hbase的rowkey (即下面的:key) age int ...

  7. Python3学习笔记-更新中

    1.Python概况 2.Anaconda安装及使用 3.Pycharm安装及使用 4.Hello World!!! 5.数据类型及类型转换 6.分支结构 7.循环语句 8.异常

  8. 基于rabbitmq的Spring-amqp基本使用

    目录 1. 依赖和配置 添加AMQP的启动器: 在application.yml中添加RabbitMQ地址: 2. 监听者 3. AmqpTemplate 4. 测试代码 Spring-amqp是对A ...

  9. phpmyadmin出现空密码登录被禁止 (参见 允许空密码)的解决办法

    在Windows或者Linux下mysql安装后默认的密码为空,又当我们又安装了mysql的管理工具phpmyadmin后登陆时出现“空密码登陆呗禁止(参见允许密码为空)”.不能登录成功        ...

  10. sql server len函数

    len函数 --返回字符表达式中的字符数 --如果字符串中包含前导空格和尾随空格,则函数将它们包含在内 --LEN对相同的单字节和双字节字符串返回相同的值 --示例:select LEN('no'), ...