在spring中配置容器

在spring中配置容器,spring,hadoop,spring-boot,spring-data,yarn,Spring,Hadoop,Spring Boot,Spring Data,Yarn,我使用的是Spring Boot 1.3.5和Spring Thread Boot 2.3.0,我遇到的问题是为YarnContainer配置resourceManagerHost和资源。在YarnClient和YarnAppMaster中,默认值将按预期被覆盖 容器应用程序具有以下application.yml: spring: profiles: dev hadoop: fsUri: hdfs://dev resourceManagerHost

我使用的是Spring Boot 1.3.5和Spring Thread Boot 2.3.0,我遇到的问题是为YarnContainer配置resourceManagerHost和资源。在YarnClient和YarnAppMaster中,默认值将按预期被覆盖

容器应用程序具有以下application.yml:

spring:
    profiles: dev
    hadoop:
        fsUri: hdfs://dev
        resourceManagerHost: rm.dev.com
        resources:
            - "file:///etc/hadoop/conf/core-site.xml"
            - "file:///etc/hadoop/conf/hdfs-site.xml"
            - "file:///etc/hadoop/conf/yarn-site.xml"

    yarn:
        appName: gs-yarn-basic
        applicationDir: /app/gs-yarn-basic/

debug: true
下面最后一行显示fs.defaultFS被正确覆盖,但Thread.resourcemanager.address被设置为0.0.0.0:8032和“配置:​" 设置为默认的xml配置文件

[2016-06-09 16:47:14.397] boot - 35635  INFO [main] --- ContainerApplication: The following profiles are active: dev
[2016-06-09 16:47:14.397] boot - 35635 DEBUG [main] --- SpringApplication: Loading source class hello.container.ContainerApplication
[2016-06-09 16:47:14.450] boot - 35635 DEBUG [main] --- ConfigFileApplicationListener: Activated profiles dev
[2016-06-09 16:47:14.450] boot - 35635 DEBUG [main] --- ConfigFileApplicationListener: Skipped (empty) config file 'classpath:/application.yml'
[2016-06-09 16:47:14.450] boot - 35635 DEBUG [main] --- ConfigFileApplicationListener: Loaded config file 'classpath:/application.yml' for profile dev
[2016-06-09 16:47:14.455] boot - 35635  INFO [main] --- AnnotationConfigApplicationContext: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@b51cdbd: startup date [Thu Jun 09 16:47:14 CEST 2016]; root of context hierarchy
[2016-06-09 16:47:16.299] boot - 35635  INFO [main] --- ConfiguringBeanFactoryPostProcessor: No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
[2016-06-09 16:47:16.303] boot - 35635  INFO [main] --- ConfiguringBeanFactoryPostProcessor: No bean named 'taskExecutor' has been explicitly defined. Therefore, a default SyncTaskExecutor will be created.
[2016-06-09 16:47:16.311] boot - 35635  INFO [main] --- AutowiredAnnotationBeanPostProcessor: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
[2016-06-09 16:47:16.461] boot - 35635  INFO [main] --- PostProcessorRegistrationDelegate$BeanPostProcessorChecker: Bean 'org.springframework.data.hadoop.config.common.annotation.configuration.ObjectPostProcessorConfiguration' of type [class org.springframework.data.hadoop.config.common.annotation.configuration.ObjectPostProcessorConfiguration$$EnhancerBySpringCGLIB$$c2374003] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[2016-06-09 16:47:16.474] boot - 35635  INFO [main] --- PostProcessorRegistrationDelegate$BeanPostProcessorChecker: Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$ca001d27] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[2016-06-09 16:47:16.543] boot - 35635  INFO [main] --- PostProcessorRegistrationDelegate$BeanPostProcessorChecker: Bean 'yarnObjectPostProcessor' of type [class org.springframework.data.hadoop.config.common.annotation.configuration.AutowireBeanFactoryObjectPostProcessor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[2016-06-09 16:47:16.569] boot - 35635  INFO [main] --- PostProcessorRegistrationDelegate$BeanPostProcessorChecker: Bean 'org.springframework.yarn.boot.properties.SpringYarnEnvProperties' of type [class org.springframework.yarn.boot.properties.SpringYarnEnvProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[2016-06-09 16:47:16.584] boot - 35635  INFO [main] --- PostProcessorRegistrationDelegate$BeanPostProcessorChecker: Bean 'spring.yarn.CONFIGURATION_PROPERTIES' of type [class org.springframework.yarn.boot.properties.SpringYarnProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[2016-06-09 16:47:16.610] boot - 35635  INFO [main] --- PostProcessorRegistrationDelegate$BeanPostProcessorChecker: Bean 'spring.hadoop.CONFIGURATION_PROPERTIES' of type [class org.springframework.yarn.boot.properties.SpringHadoopProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[2016-06-09 16:47:16.619] boot - 35635  INFO [main] --- PostProcessorRegistrationDelegate$BeanPostProcessorChecker: Bean 'spring.yarn.container.CONFIGURATION_PROPERTIES' of type [class org.springframework.yarn.boot.properties.SpringYarnContainerProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[2016-06-09 16:47:16.663] boot - 35635  INFO [main] --- PostProcessorRegistrationDelegate$BeanPostProcessorChecker: Bean 'org.springframework.yarn.boot.YarnContainerAutoConfiguration$SpringYarnConfig' of type [class org.springframework.yarn.boot.YarnContainerAutoConfiguration$SpringYarnConfig$$EnhancerBySpringCGLIB$$2caddc60] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[2016-06-09 16:47:16.675] boot - 35635  INFO [main] --- SpringYarnConfiguration: Enabling CONTAINER for Yarn
[2016-06-09 16:47:16.675] boot - 35635  INFO [main] --- PostProcessorRegistrationDelegate$BeanPostProcessorChecker: Bean 'org.springframework.yarn.config.annotation.configuration.SpringYarnContainerConfiguration' of type [class org.springframework.yarn.config.annotation.configuration.SpringYarnContainerConfiguration$$EnhancerBySpringCGLIB$$9f2964a0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[2016-06-09 16:47:16.723] boot - 35635  INFO [main] --- SpringYarnConfiguration: We couldn't figure out if we could use existing configuration
[2016-06-09 16:47:16.724] boot - 35635  INFO [main] --- SpringYarnConfiguration: Building configuration for bean 'yarnConfiguration'
[2016-06-09 16:47:16.738] boot - 35635  INFO [main] --- SpringYarnConfigBuilder: Existing yarnConfiguration: null
[2016-06-09 16:47:17.194] boot - 35635  INFO [main] --- ConfigurationFactoryBean: Overwriting fsUri=[file:///] with fsUri=[hdfs://dev]
[2016-06-09 16:47:17.323] boot - 35635  WARN [main] --- NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[2016-06-09 16:47:17.442] boot - 35635  INFO [main] --- ConfigurationFactoryBean: Executing with tokens:
[2016-06-09 16:47:17.443] boot - 35635  INFO [main] --- ConfigurationFactoryBean: Kind: HDFS_DELEGATION_TOKEN, Service: ha-hdfs:dev, Ident: (HDFS_DELEGATION_TOKEN token 21603 for anonymous)
[2016-06-09 16:47:17.511] boot - 35635  INFO [main] --- ConfigurationFactoryBean: Kind: YARN_AM_RM_TOKEN, Service: 10.4.0.91:8030, Ident: (appAttemptId { application_id { id: 111 cluster_timestamp: 1465390563601 } attemptId: 1 } keyId: -144109947)
[2016-06-09 16:47:17.665] boot - 35635  INFO [main] --- SpringYarnConfigBuilder: Setting configuration for SpringYarnConfigs:  fs.defaultFS=hdfs://dev yarn.resourcemanager.address=0.0.0.0:8032 Configuration: core-default.xml, core-site.xml, yarn-default.xml, yarn-site.xml, mapred-default.xml, mapred-site.xml

关于如何让容器应用程序获取配置,您有什么想法吗?

我也遇到了同样的问题:如何让配置工作,您能让它工作吗?