Метрики с проблемой Прометея с использованием JHipster 6.0.1 (элементы [jhipster.metrics.prometheus.enabled] остались несвязанными.) - PullRequest
0 голосов
/ 25 июня 2019

Я получаю сообщение об ошибке при запуске моего приложения JHipster с конфигурацией Prometheus для метрик.

Я использую конфигурацию с официального сайта:

https://www.jhipster.tech/monitoring/

Inмое приложение-dev.yml у меня есть:

metrics:
    prometheus:
        enabled: true

И мой класс для аутентификации:

@Configuration
@Order(1)
@ConditionalOnProperty(prefix = "jhipster", name = "metrics.prometheus.enabled")
public class BasicAuthConfiguration extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .antMatcher("/management/prometheus/**")
            .authorizeRequests()
            .anyRequest().hasAuthority(AuthoritiesConstants.ADMIN)
            .and()
            .httpBasic().realmName("jhipster")
            .and()
            .sessionManagement()
            .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
            .and().csrf().disable();
    }
}



2019-06-25 12:22:52.693  INFO 13260 --- [  restartedMain] com.ex.App                  : The following profiles are active: dev,swagger
2019-06-25 12:22:55.170  WARN 13260 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'undertowServletWebServerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedUndertow.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webConfigurer' defined in file [/home/eclipse-workspace/back_docker/target/classes/com/ex/config/WebConfigurer.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'io.github.jhipster.config.JHipsterProperties': Could not bind properties to 'JHipsterProperties' : prefix=jhipster, ignoreInvalidFields=false, ignoreUnknownFields=false; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'jhipster' to io.github.jhipster.config.JHipsterProperties
2019-06-25 12:22:55.188 ERROR 13260 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Binding to target [Bindable@7585af55 type = io.github.jhipster.config.JHipsterProperties, value = 'provided', annotations = array<Annotation>[@org.springframework.boot.context.properties.ConfigurationProperties(ignoreInvalidFields=false, ignoreUnknownFields=false, value=jhipster, prefix=jhipster)]] failed:

    Property: jhipster.metrics.prometheus.enabled
    Value: true
    Origin: class path resource [config/application-dev.yml]:128:22
    Reason: The elements [jhipster.metrics.prometheus.enabled] were left unbound.

Action:

Update your application's configuration

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  11.679 s
[INFO] Finished at: 2019-06-25T12:22:55+02:00
[INFO] ------------------------------------------------------------------------

1 Ответ

0 голосов
/ 27 июня 2019

Я изменил свой проект JHipster с микросервисного приложения на микросервисный шлюз, и он решил эту проблему.

...