dubbo的consumer端controller里面如何给service添加AOP能力

romeo2015 发布于 2016/02/18 10:28
阅读 1K+
收藏 0

@JFinal 你好,想跟你请教个问题:

怎么在consumer项目中的controller里取到ShopInfoServiceImpl中加强过的service对象?

consumer:

ShopInfoController的save方法:


boolean b = shopInfoService.save(info);


API :

ShopInfoService接口


public interface ShopInfoService {

	public abstract boolean save(KtShopInfo info);

}



Provider



public class ShopInfoServiceImpl extends BaseService implements ShopInfoService {
	
	public static final ShopInfoServiceImpl service = Enhancer.enhance(ShopInfoServiceImpl.class, Tx.class);
	
	private KtShopInfo ktShopInfoDao;
	
	
	@Override
	public boolean save(KtShopInfo info){
		if (info == null) {
			return false;
		}
		return info.save();
	}


	public KtShopInfo getKtShopInfoDao() {
		return ktShopInfoDao;
	}


	public void setKtShopInfoDao(KtShopInfo ktShopInfoDao) {
		this.ktShopInfoDao = ktShopInfoDao;
	}
}




加载中
0
JFinal
JFinal
    用一下 jfinal 的业务层 AOP 即可,使用 Duang.duang(target) 或者 Enhancer.enhance(target),具体用法详见 jfinal 手册,在此下载:http://www.jfinal.com
返回顶部
顶部