springmc注解

来源:互联网 发布:淘宝客服工作总结1 编辑:程序博客网 时间:2024/06/16 13:41



接口与实现方法(一般是将实现方法交给spring管理)

@Service是标注在实现类上而不是接口

但是,@Resource(name="userService") 就是将接口主人Controller类的

@Resource(name="userService")

public UserService  userService;

@Service("userService")public class UserServiceImpl implements UserService {@Resource(name="userMapper") private UserMapper userMapper;/* (non-Javadoc) * @see com.restaurant.serviceimpl.UserService#getUserById(java.lang.String) */@Overridepublic User getUserById(String userid){System.out.println("services");User user=userMapper.selectByPrimaryKey(userid);return user;}}


0 0