I have a Bean
defined in a class decorated with @Configuration:
@Configuration
public class MyBeanConfig {
@Bean
public String configPa
Make sure that the method name of your @Bean factory method does not match any existing bean name. I had issues with method names like config() or (in my case) prometheusConfig() which collided with existing bean names. Spring skips those factory methods silently and simply does not call them / does not instantiate the beans.
If you want to override a bean definition in your test, use the bean name explicitly as string parameter in your @Bean("beanName") annotation.