spring 上下文获取bean出错

ServletContext servletContext = this.pageContext.getServletContext();
WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(servletContext);
RolePowService rolePowService = (RolePowService) wac.getBean("rolePowService");

出错No bean named 'rolePowService' is defined
求大神指导一下

注意大小写:
1.命名空间的问题 2.在实现类中添加注解 3.数据库命名与java类的service注解的命名一致

在rolePowService上面加注解 @service

spring容器中不存在rolePowService这个bean,没有注入成功

你想要引用这个bean,要先注入进去,加一个@service