private void registerOn(BeanDefinitionRegistry registry, Class<?> type) {
registerOn(registry, type, false);
}
private void registerOn(BeanDefinitionRegistry registry, Class<?> type, boolean customComponent) {
AnnotatedGenericBeanDefinition definition = new AnnotatedGenericBeanDefinition(type);
definition.setLazyInit(true);
definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_NO);
if (customComponent) {
definition.setPrimary(true);
definition.setRole(BeanDefinition.ROLE_APPLICATION);
} else {
definition.setPrimary(false);
definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
}
String name = beanNameGenerator.generateBeanName(definition, registry);
BeanDefinitionHolder definitionHolder = new BeanDefinitionHolder(definition, name);