2016-03-30 7 views
0

autowired豆とエラーSPRING MVC - 私はそのモジュールでこのMavenプロジェクト</p> <p>親を持つ

| _____モデル

| _____永続

| _____サービス

  |_ service-context.xml 

| _____見ます

  |_ spring/app-config.xml 

私はビューモジュールにサービスモジュールで

@Controller 

public class HomeController { 

protected final Log logger = LogFactory.getLog(getClass()); 

private IServicioService servicioService; 

@RequestMapping(value="/home.htm") 
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) 
     throws ServletException, IOException { 

    logger.info("Returning hello view"); 

    return new ModelAndView("home.jsp"); 
} 

@Autowired 
public void setServicioService(IServicioService servicioService) { 
    this.servicioService = servicioService; 
} 

そして、私のサービスservicios.ServicioService

@Service 
public class ServicioService implements IServicioService{ 

private ServicioDao servicioDao; 

public ServicioService(){} 

/*************************** Gett&Sett ****************************/ 

public ServicioDao getServicioDao() { 
    return servicioDao; 
} 

public void setServicioDao(ServicioDao servicioDao) { 
    this.servicioDao = servicioDao; 
} 

}

をこのコントローラ controllers.HomeControllerを持っていますIServicioServiceはServicioService Beanが**この

<bean id="servicioService" class="servicios.ServicioService"> 
    <property name="servicioDao" ref="servicioDao" /> 
</bean> 

のようなサービスのcontext.xmlで定義され、私のアプリ-config.xmlには**

サービスのcontext.xmlを輸入している@Service をhasnt少なくとも1豆期待この依存性のためにautowire候補としての資格:
<import resource="classpath*:service-context.xml" /> 
    <context:component-scan base-package="controllers" /> 

はなぜ依存見つかり[servicios.ServicioService]タイプのこの

一致するBeanを与えていないIDK。依存関係の注釈:{}

ヘルプ!

答えて

1

おそらく、問題はxml構成の中にあります。あなたのアプリ-config.xmlのラインに追加 してみてください。

その後
<context:component-scan base-package="servicios" /> 

あなたがDAOS

+0

と同じことを行うべきではありがとうございました!!それは、私はその行を追加し、それは働いた – evilkorona

関連する問題

 関連する問題