<!-- 引 用 dubbo 服 务 -->
<dubbo:application name="pinyougou-shop-web" />
<dubbo:registry address="zookeeper://192.168.25.132:2181"/>
<dubbo:annotation package="com.pinyougou.shop.controller" />
4.4实体类与数据访问层模块
4.4.1生成代码
利用反向工程 generatorSqlmapCustom 实现实体类与数据访问层代码的自动生成
字段 | 类型 | 长度 | 含义 |
Id | Bigint | 主键 | |
Name | Varchar | 255 | 品牌名称 |
First_char | Varchar | 1 | 品牌首字母 |
package com.pinyougou.sellergoods.service;
import java.util.List;
import com.pinyougou.pojo.TbBrand;
/**
*品牌服务层接口
*@author Administrator
*
*/
public interface BrandService {
/**
*返回全部列表
*@return
*/
public List<TbBrand> findAll();
}
package com.pinyougou.sellergoods.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.config.annotation.Service;
import com.pinyougou.mapper.TbBrandMapper;
import com.pinyougou.pojo.TbBrand;
import com.pinyougou.sellergoods.service.BrandService; @Service
public class BrandServiceImpl implements BrandService { @Autowired
private TbBrandMapper brandMapper; @Override
public List<TbBrand> findAll() {
return brandMapper.selectByExample(null);
}
}
package com.pinyougou.manager.controller;
import java.util.List;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.alibaba.dubbo.config.annotation.Reference;
import com.pinyougou.pojo.TbBrand;
import com.pinyougou.sellergoods.service.BrandService;
/**
* 品牌 controller
* @author Administrator
*/ @RestController
@RequestMapping("/brand")
public class BrandController { @Reference
private BrandService brandService;
/**
*返回全部列表
*@return
*/ @RequestMapping("/findAll")
public List<TbBrand> findAll(){
return brandService.findAll();
}
}
java.lang.IllegalStateException: Failed to check the status of the service com.pinyougou.sellergoods.service.BrandService. No provider available for the service com.pinyougou.sellergoods.service.BrandService from the url zookeeper://192.168.25.129:2181/com.alibaba.dubbo.registry.RegistryService?application=pinyo ugou-manager- web&dubbo=2.8.4&interface=com.pinyougou.sellergoods.service.BrandService&methods=updat e,get,delete,selectOptionList,add,getListByPage&pid=3980&revision=0.0.1- SNAPSHOT&side=consumer×tamp=1501146823396 to the consumer 172.16.17.14 use dubbo version 2.8.4
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |