0

I am using FullyQualifiedAnnotationBeanNameGenerator which comes from org.springframework:spring-context. With the latest pom upgrade I see this class is not present in spring-context jar. What is the substitute of this class now? I am using org.springframework:spring-context:jar:4.3.25.RELEASE

mitali
  • 87
  • 8

2 Answers2

0

you have upgraded from which version to 4.3.25-RELEASE

If we follow the spring documentation: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/FullyQualifiedAnnotationBeanNameGenerator.html

this annotation was introduced since 5.2.3

can you please try using this 5.2.3 or above version and it should solve your problem.

0

Here is the solution. if your spring-context is lower than 5.2.3.RELEASE.

Use this approach:

  1. You can implement your own bean-name generation strategy which use fully-qualified name:
public class UniqueBeanNameGenerator extends AnnotationBeanNameGenerator {
       
    @Override
    public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
        return definition.getBeanClassName();
    }
}
  1. Add this to spring boot app start class
@SpringBootApplication
@ComponentScan(nameGenerator=UniqueNameGenerator.class)
public class Application {
   public static void main(String[] args) {
       SpringApplication.run(Application.class, args);
   }
}
Elikill58
  • 4,050
  • 24
  • 23
  • 45
mitali
  • 87
  • 8