我正在嘗試爲Hadoop/Hive環境配置Bean。根據文檔,我需要Apache Hadoop配置類,它應該是自動裝配的。請參閱:http://docs.spring.io/spring-hadoop/docs/2.4.0.RELEASE/reference/html/springandhadoop-store.html(第6.2.2配置數據集的支持)Spring Hadoop配置 - 沒有符合條件的bean類型org.apache.hadoop.conf.Configuration
然而,當我嘗試運行我的應用程序,我得到:NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.hadoop.conf.Configuration] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.
我的課很簡單:
@SpringBootApplication
public class HiveTestApp implements CommandLineRunner {
private
@Autowired
org.apache.hadoop.conf.Configuration hadoopConfiguration;
...
我使用Cloudera的集羣,這裏有依賴關係:
dependencies {
compile(
'org.springframework.boot:spring-boot-starter-web',
'org.springframework.data:spring-data-hadoop-hive:2.4.0.RELEASE-cdh5',
'org.apache.hive:hive-jdbc:1.1.0-cdh5.4.3',
)
現在,我可能是錯的,但我可以在我用自動裝配Autowired配置過去的記憶,它工作得很好。最新版本有什麼變化?我錯過了什麼嗎?
http://docs.spring.io/spring-hadoop/docs/2.4.0.RELEASE/reference/html/springandhadoop-config.html#springandhadoop-config-bootsupport - configuration。示例https://github.com/spring-projects/spring-hadoop-samples –
我已經去過了。這很多都需要你編寫Spring XML配置文件,我想避免這些。我從來沒有用過它們,現在一定不要使用它們。 – waste