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