2012-05-25 148 views
0

我想用Spring注释来定义控制器,服务和道,但失败。服务的春天批注

错误消息是

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.abs.absbase.ABSService] is defined: Unsatisfied dependency of type [interface com.abs.absbase.ABSService]: expected at least 1 matching bean 

但我定义服务。

另一个问题是,如何定义一个sessionfactory来覆盖ABSDaoImpl中的HibernateDaoSupport?

感谢

源代码

@Controller 
@RequestMapping("/abs.do") 
public class ABSController {  
    @Autowired 
    @Qualifier("ABSService") 
    ABSService service; 
    ... 
} 

@Service(value="ABSService") 
public class ABSServiceImpl implements ABSService { 
    @Autowired 
    @Qualifier("ABSDao") 
    ABSDao dao; 
} 

@Repository(value="ABSDao") 
public class ABSDaoImpl extends HibernateDaoSupport implements ABSDao { 
    ... 
} 

回答

0

据我你只需要删除您ABSService对象在控制器声明上面定义的@Qualifier注解。并从服务的@Service注释中删除(value =“ABSService”)

希望这可以帮助你。

干杯。

+0

不,不起作用。 – user595234