org.springframework.beans.factory.BeanCreationException: Could not autowire

由于我在项目中引用了如下代码,增加了

@Configuration
public class Connection {
    public @Bean HttpClientConfig httpClientConfig() {  
        String connectionUrl = "http://192.168.1.13:9200";  
        HttpClientConfig httpClientConfig = new HttpClientConfig.Builder(connectionUrl).multiThreaded(true).build();  
        return httpClientConfig;  
    }  
   @Bean(name="jestClient")
    public  JestClient jestClient() {  
        JestClientFactory factory = new JestClientFactory();  
          
        return factory.getObject();  
    }  
}

没有在项目中加入扫描的包,因此出现的这个情况,在bean中增加自动扫描的包如下:

<context:component-scan base-package="com.shanjin.oxm.service.impl,com.shanjin.oxm,com.shanjin.interceptor,com.shanjin.elasticsearch" />

posted @ 2017-08-10 10:53  李悠然  阅读(4281)  评论(0编辑  收藏  举报