Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.1.5 (Lovelace SR5)
-
Fix Version/s: 2.2 M3 (Moore)
-
Component/s: Repositories
-
Labels:None
Description
Spring-boot allows to configure a custom BeanNameGenerator. This custom BeanNameGenerator is not picked up by spring-data, but rather the default implementation is still gonna being used. This leads to unexpected bean names at best, or subtile errors at worst, especially with spring-boot 2.0.x versions, which allow to override bean definitions by default.
I am not completely sure, if that's a bug or a feature, at least it is somehow unexpected. When I configure a custom BeanNameGenerator for spring, I would expect it to be used not only in a subset of spring-projects.
@SpringBootApplication public class Application { public static final AnnotationBeanNameGenerator FQCN_BEAN_NAME_GENERATOR = new AnnotationBeanNameGenerator() { @Override protected String buildDefaultBeanName(BeanDefinition definition) { String beanClassName = definition.getBeanClassName(); Assert.state(beanClassName != null, "No bean class name set"); return beanClassName; } }; public static void main(final String[] args) { SpringApplication application = new SpringApplication(Application.class); application.setBeanNameGenerator(FQCN_BEAN_NAME_GENERATOR); application.run(args); } }
Attachments
Issue Links
- supersedes
-
DATACMNS-1228 Allow custom bean name generator for repositories
-
- Closed
-
-
DATAJPA-1232 Allow custom bean name generator for repositories
-
- Closed
-