1、根据名称注入
@Resource(name = "userService") private UserService userService;
@Service("userService") public class UserServiceImpl implements UserService
2、不指定名称,根据属性名进行注入
@Resource private UserService userService;
@Service("userService") public class UserServiceImpl implements UserService
3、根据类型进行注入
@Resource private UserService userService;
@Service public class UserServiceImpl implements UserService
标签:implements,UserServiceImpl,Resource,Service,userService,UserService,注入 From: https://www.cnblogs.com/jixian/p/17157460.html