标签:
1.引入pom文件:
<dependency> <groupId>cn.bidlink.nbl</groupId> <artifactId>framework-zbus</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency>
2.引入spring文件:
framework-zbus jar文件中classpath:spring/applicationContext-framework-zbus.xml
3.对外提供服务:结合spring在service层代码类上添加注解@ZbusService
model
public class Project implements Serializable{ private String id; public String getId() { return id; } public void setId(String id) { this.id = id; } }
service interface
public interface ProjectService { public Project getOne(); }
service interface impl
@Service @ZbusService public class ProjectServiceImpl implements ProjectService{ @Override public Project getOne() { Project project = new Project(); project.setId("1"); return project; } }
4.client端调用:
引入spring文件 framework-zbus jar文件中classpath:spring/applicationContext-framework-zbus.xml
@Controller public class ProjectAction { private ProjectService projectService; @ZbusService public void setProjectService(ProjectService projectService) { this.projectService = projectService; } @RequestMapping("getOne") public Project getOne(){ return projectService.getOne(); } }
标签:
原文地址:http://my.oschina.net/sourcecoding/blog/515782