Is it possible to set a bean name using annotations in Spring Framework?

What you are asking is already available in Spring reference

By default, configuration classes use a @Bean method’s name as the
name of the resulting bean. This functionality can be overridden,
however, with the name attribute.

@Configuration
public class AppConfig {

    @Bean(name = "myFoo")
    public Foo foo() {
        return new Foo();
    }

}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)