Upon upgrading my project from 2.7.4 to 3.0.0 and starting the application, I now get an error

Consider defining a bean of type 'com.package.Credentials' in your configuration.

Even though the bean does exist.

@Configuration
public class CredentialsConfig {

  @Bean
  public Credentials configure() {
    return new Credentials();
  }
}

But the actual cause of this issue is that elsewhere in the project, I define a bean of a different type from a method also called configure().

But there are no errors in the logs like "cannot register Bean of type Credentials with name configure because name is already taken", so it took me quite a while to track it down to this.

Is this breaking change to bean naming mechanics documented anywhere?

Comment From: wilkinsona

When two beans are defined with the same name, the second definition will try to override the first. This should fail by default as bean definition overriding is disabled by default. This has been the case for a while now and hasn't changed in Spring Boot 3.0 so it's not clear to me what's happening in your case. I would guess that something may have enabled overriding but this is just a guess at this point. If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

Comment From: lbenedetto

This should fail be default

You're right. Looks like we have spring.main.allow-bean-definition-overriding=true, so that's why I didn't get a useful error message.

And the reason I ran into the issue at all was because WebSecurityConfigurerAdapter is deprecated in 3.0, so I changed the @Overide public void configure(... to @Bean public SecurityFilterChain configure(...

So all is now explained.