Java 类org.springframework.boot.actuate.info.InfoContributor 实例源码

项目:orbit-spring    文件:ActorInfoContributorReference.java   
InfoContributor getInfoContributor()
{
    InfoContributor infoContributor = reference.get();
    if (infoContributor == null)
    {
        throw new ExpiredReferenceException(this);
    }
    return infoContributor;
}
项目:orbit-spring    文件:ActorInfoContributorLifetimeExtension.java   
private Task<?> doIfInfoContributor(final AbstractActor<?> actor,
                                    final Consumer<ActorInfoContributorReference> synchronizedAction)
{
    if (actor instanceof InfoContributor)
    {
        ActorInfoContributorReference actorInfoContributorReference =
                new ActorInfoContributorReference(actorTypeResolver, actor);
        synchronized (actorInfoContributorReferences)
        {
            synchronizedAction.accept(actorInfoContributorReference);
        }
    }
    return Task.done();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoContributorAutoConfiguration.java   
@Bean
@ConditionalOnEnabledInfoContributor("build")
@ConditionalOnSingleCandidate(BuildProperties.class)
@Order(DEFAULT_ORDER)
public InfoContributor buildInfoContributor(BuildProperties buildProperties) {
    return new BuildInfoContributor(buildProperties);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointAutoConfiguration.java   
public EndpointAutoConfiguration(
        ObjectProvider<HealthAggregator> healthAggregatorProvider,
        ObjectProvider<Map<String, HealthIndicator>> healthIndicatorsProvider,
        ObjectProvider<List<InfoContributor>> infoContributorsProvider,
        ObjectProvider<Collection<PublicMetrics>> publicMetricsProvider,
        ObjectProvider<TraceRepository> traceRepositoryProvider) {
    this.healthAggregator = healthAggregatorProvider.getIfAvailable();
    this.healthIndicators = healthIndicatorsProvider.getIfAvailable();
    this.infoContributors = infoContributorsProvider.getIfAvailable();
    this.publicMetrics = publicMetricsProvider.getIfAvailable();
    this.traceRepository = traceRepositoryProvider.getIfAvailable();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoEndpoint.java   
private static List<InfoContributor> createContributors(Map<String, Object> info,
        InfoContributor[] infoContributors) {
    List<InfoContributor> result = new ArrayList<InfoContributor>(
            Arrays.asList(infoContributors));
    result.add(0, new MapInfoContributor(info));
    return result;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoEndpoint.java   
@Override
public Map<String, Object> invoke() {
    Info.Builder builder = new Info.Builder();
    for (InfoContributor contributor : this.infoContributors) {
        contributor.contribute(builder);
    }
    builder.withDetails(getAdditionalInfo());
    Info build = builder.build();
    return build.getDetails();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoContributorAutoConfigurationTests.java   
@Test
public void disableEnvContributor() {
    load("management.info.env.enabled:false");
    Map<String, InfoContributor> beans = this.context
            .getBeansOfType(InfoContributor.class);
    assertThat(beans).hasSize(0);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoContributorAutoConfigurationTests.java   
@Test
public void defaultInfoContributorsDisabled() {
    load("management.info.defaults.enabled:false");
    Map<String, InfoContributor> beans = this.context
            .getBeansOfType(InfoContributor.class);
    assertThat(beans).hasSize(0);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoContributorAutoConfigurationTests.java   
@Test
public void defaultInfoContributorsDisabledWithCustomOne() {
    load(CustomInfoContributorConfiguration.class,
            "management.info.defaults.enabled:false");
    Map<String, InfoContributor> beans = this.context
            .getBeansOfType(InfoContributor.class);
    assertThat(beans).hasSize(1);
    assertThat(this.context.getBean("customInfoContributor"))
            .isSameAs(beans.values().iterator().next());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoContributorAutoConfigurationTests.java   
@SuppressWarnings("unchecked")
@Test
public void gitPropertiesDefaultMode() {
    load(GitPropertiesConfiguration.class);
    Map<String, InfoContributor> beans = this.context
            .getBeansOfType(InfoContributor.class);
    assertThat(beans).containsKeys("gitInfoContributor");
    Map<String, Object> content = invokeContributor(
            this.context.getBean("gitInfoContributor", InfoContributor.class));
    Object git = content.get("git");
    assertThat(git).isInstanceOf(Map.class);
    Map<String, Object> gitInfo = (Map<String, Object>) git;
    assertThat(gitInfo).containsOnlyKeys("branch", "commit");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoContributorAutoConfigurationTests.java   
@SuppressWarnings("unchecked")
@Test
public void gitPropertiesFullMode() {
    load(GitPropertiesConfiguration.class, "management.info.git.mode=full");
    Map<String, Object> content = invokeContributor(
            this.context.getBean("gitInfoContributor", InfoContributor.class));
    Object git = content.get("git");
    assertThat(git).isInstanceOf(Map.class);
    Map<String, Object> gitInfo = (Map<String, Object>) git;
    assertThat(gitInfo).containsOnlyKeys("branch", "commit", "foo");
    assertThat(gitInfo.get("foo")).isEqualTo("bar");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoContributorAutoConfigurationTests.java   
@SuppressWarnings("unchecked")
@Test
public void buildProperties() {
    load(BuildPropertiesConfiguration.class);
    Map<String, InfoContributor> beans = this.context
            .getBeansOfType(InfoContributor.class);
    assertThat(beans).containsKeys("buildInfoContributor");
    Map<String, Object> content = invokeContributor(
            this.context.getBean("buildInfoContributor", InfoContributor.class));
    Object build = content.get("build");
    assertThat(build).isInstanceOf(Map.class);
    Map<String, Object> buildInfo = (Map<String, Object>) build;
    assertThat(buildInfo).containsOnlyKeys("group", "artifact", "foo");
    assertThat(buildInfo.get("foo")).isEqualTo("bar");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoContributorAutoConfigurationTests.java   
@Bean
public InfoContributor customInfoContributor() {
    return new InfoContributor() {
        @Override
        public void contribute(Info.Builder builder) {
        }
    };
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointAutoConfigurationTests.java   
@Bean
@Order(InfoContributorAutoConfiguration.DEFAULT_ORDER - 1)
public InfoContributor myInfoContributor() {
    return new InfoContributor() {
        @Override
        public void contribute(Info.Builder builder) {
            builder.withDetail("name", "bar");
            builder.withDetail("version", "1.0");
        }
    };
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoEndpointTests.java   
@Bean
public InfoContributor infoContributor() {
    return new InfoContributor() {

        @Override
        public void contribute(Info.Builder builder) {
            builder.withDetail("key1", "value1");
        }

    };
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoEndpointCompatibilityTests.java   
private InfoContributor infoContributor() {
    return new InfoContributor() {

        @Override
        public void contribute(Info.Builder builder) {
            builder.withDetail("key1", "value1");
        }

    };
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoMvcEndpointTests.java   
@Bean
public InfoContributor beanName1() {
    return new InfoContributor() {

        @Override
        public void contribute(Info.Builder builder) {
            Map<String, Object> content = new LinkedHashMap<String, Object>();
            content.put("key11", "value11");
            content.put("key12", "value12");
            builder.withDetail("beanName1", content);
        }
    };
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoMvcEndpointTests.java   
@Bean
public InfoContributor beanName2() {
    return new InfoContributor() {
        @Override
        public void contribute(Info.Builder builder) {
            Map<String, Object> content = new LinkedHashMap<String, Object>();
            content.put("key21", "value21");
            content.put("key22", "value22");
            builder.withDetail("beanName2", content);
        }
    };
}
项目:spring-boot-concourse    文件:InfoContributorAutoConfiguration.java   
@Bean
@ConditionalOnEnabledInfoContributor("build")
@ConditionalOnSingleCandidate(BuildProperties.class)
@Order(DEFAULT_ORDER)
public InfoContributor buildInfoContributor(BuildProperties buildProperties) {
    return new BuildInfoContributor(buildProperties);
}
项目:spring-boot-concourse    文件:EndpointAutoConfiguration.java   
public EndpointAutoConfiguration(
        ObjectProvider<HealthAggregator> healthAggregatorProvider,
        ObjectProvider<Map<String, HealthIndicator>> healthIndicatorsProvider,
        ObjectProvider<List<InfoContributor>> infoContributorsProvider,
        ObjectProvider<Collection<PublicMetrics>> publicMetricsProvider,
        ObjectProvider<TraceRepository> traceRepositoryProvider) {
    this.healthAggregator = healthAggregatorProvider.getIfAvailable();
    this.healthIndicators = healthIndicatorsProvider.getIfAvailable();
    this.infoContributors = infoContributorsProvider.getIfAvailable();
    this.publicMetrics = publicMetricsProvider.getIfAvailable();
    this.traceRepository = traceRepositoryProvider.getIfAvailable();
}
项目:spring-boot-concourse    文件:InfoEndpoint.java   
private static List<InfoContributor> createContributors(Map<String, Object> info,
        InfoContributor[] infoContributors) {
    List<InfoContributor> result = new ArrayList<InfoContributor>(
            Arrays.asList(infoContributors));
    result.add(0, new MapInfoContributor(info));
    return result;
}
项目:spring-boot-concourse    文件:InfoEndpoint.java   
@Override
public Map<String, Object> invoke() {
    Info.Builder builder = new Info.Builder();
    for (InfoContributor contributor : this.infoContributors) {
        contributor.contribute(builder);
    }
    builder.withDetails(getAdditionalInfo());
    Info build = builder.build();
    return build.getDetails();
}
项目:spring-boot-concourse    文件:InfoContributorAutoConfigurationTests.java   
@Test
public void disableEnvContributor() {
    load("management.info.env.enabled:false");
    Map<String, InfoContributor> beans = this.context
            .getBeansOfType(InfoContributor.class);
    assertThat(beans).hasSize(0);
}
项目:spring-boot-concourse    文件:InfoContributorAutoConfigurationTests.java   
@Test
public void defaultInfoContributorsDisabled() {
    load("management.info.defaults.enabled:false");
    Map<String, InfoContributor> beans = this.context
            .getBeansOfType(InfoContributor.class);
    assertThat(beans).hasSize(0);
}
项目:spring-boot-concourse    文件:InfoContributorAutoConfigurationTests.java   
@Test
public void defaultInfoContributorsDisabledWithCustomOne() {
    load(CustomInfoContributorConfiguration.class,
            "management.info.defaults.enabled:false");
    Map<String, InfoContributor> beans = this.context
            .getBeansOfType(InfoContributor.class);
    assertThat(beans).hasSize(1);
    assertThat(this.context.getBean("customInfoContributor"))
            .isSameAs(beans.values().iterator().next());
}
项目:spring-boot-concourse    文件:InfoContributorAutoConfigurationTests.java   
@SuppressWarnings("unchecked")
@Test
public void gitPropertiesDefaultMode() {
    load(GitPropertiesConfiguration.class);
    Map<String, InfoContributor> beans = this.context
            .getBeansOfType(InfoContributor.class);
    assertThat(beans).containsKeys("gitInfoContributor");
    Map<String, Object> content = invokeContributor(
            this.context.getBean("gitInfoContributor", InfoContributor.class));
    Object git = content.get("git");
    assertThat(git).isInstanceOf(Map.class);
    Map<String, Object> gitInfo = (Map<String, Object>) git;
    assertThat(gitInfo).containsOnlyKeys("branch", "commit");
}
项目:spring-boot-concourse    文件:InfoContributorAutoConfigurationTests.java   
@SuppressWarnings("unchecked")
@Test
public void gitPropertiesFullMode() {
    load(GitPropertiesConfiguration.class, "management.info.git.mode=full");
    Map<String, Object> content = invokeContributor(
            this.context.getBean("gitInfoContributor", InfoContributor.class));
    Object git = content.get("git");
    assertThat(git).isInstanceOf(Map.class);
    Map<String, Object> gitInfo = (Map<String, Object>) git;
    assertThat(gitInfo).containsOnlyKeys("branch", "commit", "foo");
    assertThat(gitInfo.get("foo")).isEqualTo("bar");
}
项目:spring-boot-concourse    文件:InfoContributorAutoConfigurationTests.java   
@SuppressWarnings("unchecked")
@Test
public void buildProperties() {
    load(BuildPropertiesConfiguration.class);
    Map<String, InfoContributor> beans = this.context
            .getBeansOfType(InfoContributor.class);
    assertThat(beans).containsKeys("buildInfoContributor");
    Map<String, Object> content = invokeContributor(
            this.context.getBean("buildInfoContributor", InfoContributor.class));
    Object build = content.get("build");
    assertThat(build).isInstanceOf(Map.class);
    Map<String, Object> buildInfo = (Map<String, Object>) build;
    assertThat(buildInfo).containsOnlyKeys("group", "artifact", "foo");
    assertThat(buildInfo.get("foo")).isEqualTo("bar");
}
项目:spring-boot-concourse    文件:InfoContributorAutoConfigurationTests.java   
@Bean
public InfoContributor customInfoContributor() {
    return new InfoContributor() {
        @Override
        public void contribute(Info.Builder builder) {
        }
    };
}
项目:spring-boot-concourse    文件:EndpointAutoConfigurationTests.java   
@Bean
@Order(InfoContributorAutoConfiguration.DEFAULT_ORDER - 1)
public InfoContributor myInfoContributor() {
    return new InfoContributor() {
        @Override
        public void contribute(Info.Builder builder) {
            builder.withDetail("name", "bar");
            builder.withDetail("version", "1.0");
        }
    };
}
项目:spring-boot-concourse    文件:InfoEndpointTests.java   
@Bean
public InfoContributor infoContributor() {
    return new InfoContributor() {

        @Override
        public void contribute(Info.Builder builder) {
            builder.withDetail("key1", "value1");
        }

    };
}
项目:spring-boot-concourse    文件:InfoEndpointCompatibilityTests.java   
private InfoContributor infoContributor() {
    return new InfoContributor() {

        @Override
        public void contribute(Info.Builder builder) {
            builder.withDetail("key1", "value1");
        }

    };
}
项目:spring-boot-concourse    文件:InfoMvcEndpointTests.java   
@Bean
public InfoContributor beanName1() {
    return new InfoContributor() {

        @Override
        public void contribute(Info.Builder builder) {
            Map<String, Object> content = new LinkedHashMap<String, Object>();
            content.put("key11", "value11");
            content.put("key12", "value12");
            builder.withDetail("beanName1", content);
        }
    };
}
项目:spring-boot-concourse    文件:InfoMvcEndpointTests.java   
@Bean
public InfoContributor beanName2() {
    return new InfoContributor() {
        @Override
        public void contribute(Info.Builder builder) {
            Map<String, Object> content = new LinkedHashMap<String, Object>();
            content.put("key21", "value21");
            content.put("key22", "value22");
            builder.withDetail("beanName2", content);
        }
    };
}
项目:springbootcamp    文件:ConfigServiceApplication.java   
@Bean
InfoContributor infoContributor() {
  return builder -> {

    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    try {
      for (Resource r : resolver.getResources("classpath:configuration/*.yml")) {
        builder.withDetail(r.getFilename(), "/" + r.getFilename().replaceAll("\\.yml","") + "/native");
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  };

}
项目:orbit-spring    文件:ActorInfoContributorReference.java   
ActorInfoContributorReference(final Function<AbstractActor, Class> actorTypeResolver, final AbstractActor<?> actor)
{
    reference = new WeakReference<>((InfoContributor) actor);
    name = actorTypeResolver.apply(actor).getSimpleName();
    identity = ((Actor) actor).getIdentity();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
public InfoEndpoint infoEndpoint() throws Exception {
    return new InfoEndpoint(this.infoContributors == null
            ? Collections.<InfoContributor>emptyList() : this.infoContributors);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoEndpoint.java   
/**
 * Create a new {@link InfoEndpoint} instance.
 * @param infoContributors the info contributors to use
 */
public InfoEndpoint(List<InfoContributor> infoContributors) {
    super("info", false);
    Assert.notNull(infoContributors, "Info contributors must not be null");
    this.infoContributors = infoContributors;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoContributorAutoConfigurationTests.java   
private Map<String, Object> invokeContributor(InfoContributor contributor) {
    Info.Builder builder = new Info.Builder();
    contributor.contribute(builder);
    return builder.build().getDetails();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointAutoConfigurationTests.java   
@Bean
@Order(InfoContributorAutoConfiguration.DEFAULT_ORDER + 1)
public InfoContributor myAnotherContributor(ProjectInfoProperties properties)
        throws IOException, BindException {
    return new GitFullInfoContributor(properties.getGit().getLocation());
}