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" />


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM