citrusframework / citrus

Framework for automated integration tests with focus on messaging integration
https://citrusframework.org
Apache License 2.0
445 stars 135 forks source link

How to remove warnings "Bean 'citrusSpringConfig' and Bean 'citrusReferenceResolver' not eligible for getting processed by all BeanPostProcessors" #1185

Open pablopaul opened 2 days ago

pablopaul commented 2 days ago

Citrus Version 4.2.1

Question I get the following warnings when running my citrus test:

WARN  PostProcessorChecker| Bean 'citrusSpringConfig' of type [org.citrusframework.config.CitrusSpringConfig$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [citrusComponentInitializer] is declared through a non-static factory method on that class; consider declaring it as static instead.

WARN  PostProcessorChecker| Bean 'citrusReferenceResolver' of type [org.citrusframework.context.SpringBeanReferenceResolver] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [citrusComponentInitializer]? Check the corresponding BeanPostProcessor declaration and its dependencies.

How to get rid of the warnings?

Additional information

EndpointConfig.java looks like:


package com.pablopaul.integrationtests;

import org.citrusframework.kafka.endpoint.KafkaEndpoint;
import org.citrusframework.kafka.endpoint.KafkaEndpointBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import java.util.HashMap;

@Configuration
public class EndpointConfig {
    @Autowired
    Environment env;

    @Bean
    public KafkaEndpoint kafkaEndpoint() {

        String keyvaultUri = env.getProperty("keyvault.uri");
        AzureKeyVault keyVaultClient = new AzureKeyVault(keyvaultUri);

        String apiKey = keyVaultClient.getSecret("api-key");
        String apiSecret = keyVaultClient.getSecret("api-secret");

        HashMap<String, Object> endpointProps = new HashMap<>();
        endpointProps.put("security.protocol", "SASL_SSL");
        endpointProps.put("ssl.endpoint.identification.algorithm", "https");
        endpointProps.put("sasl.mechanism", "PLAIN");

        endpointProps.put("sasl.jaas.config",
            "org.apache.kafka.common.security.plain.PlainLoginModule required username='" + apiKey + "' password='" + apiSecret + "';");

        return new KafkaEndpointBuilder()
            .server(env.getProperty("kafka.broker.uri"))
            .producerProperties(endpointProps)
            .consumerProperties(endpointProps)
            .topic(env.getProperty("kafka.topic"))
            .build();
    }
}