ITeye博客

spring

共 3 篇文章

RestTemplate用法

RestTemplate 这篇文章打算介绍一下Spring的 RestTemplate 。我这边以前设计到http交互的,之前一直采用的是 Apache HttpComponents 。后来发现Spring框架中已经为我们封装好了这个框架。因此我们就不需要直接使用下面这种稍微底层一点的方式来实现我们的功能: String uri = "http://example.com/hotels/1/bookings"; PostMethod post = new PostMethod(uri); String request = // create booking request content p…

2016-03-02 16:26 · java · spring

spring学习---导入源码到Eclipse工程

第一步: 磨刀不误砍柴工,先下载一个集成了Spring Tool Suite 的Eclipse, http://spring.io/tools/eclipse ,下载for javaEE Developers 的版本. 第二步: 安装完Eclipse之后,打开

2014-11-10 16:54 · spring

spring Aop 事务控制

做开发几年了,一直也没搞清楚spring的事务传播性怎么回事,用的不太到位,经常出问题,最近在架构师课程上又学习到了这个地方,正好我们现在做的项目也用到了. public class ServiceA{ private ServiceB b; void a(){ b.b3(); } } public class ServiceB{ void b1(); void b2(); void b3(){ b1(); b2(); } } 假如传播性是 REQUIRED_NEW ,ServiceA,ServiceB 的 里面的方法都符合spring的切点规则,那么在调用 a() 的时候spring 容器…

2014-04-04 19:37 · java · spring · Spring · 事务