spring注入通过注解方式实现

public class LoginForUserAction extends ActionSupportExtend {
 
 @Autowired
 private TbUserService tbUserService;

}

public interface TbUserService {}


@Service
public class TbUserServiceImpl implements TbUserService {
 
 @Autowired
 private TbuserDAO tbuserDAO;
}

public interface TbuserDAO {}

@Repository
public class TbuserDAOImpl extends DataAccess implements TbuserDAO {}

---------------------------------------------

在一次开发中 Action 中的Service实现类总是没有注入进来,通过仔细查找才发现,在ServiceImpl上没有添加@Service注解。。立刻悲剧类

猜你喜欢

转载自1055592535.iteye.com/blog/1698566