码迷,mamicode.com
首页 > 其他好文 > 详细

【zbus】framework-zbus 使用用例

时间:2015-10-12 12:53:57      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:

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();
	}
}



【zbus】framework-zbus 使用用例

标签:

原文地址:http://my.oschina.net/sourcecoding/blog/515782

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!