use of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition in project spring-framework by spring-projects.
the class AnnotationBeanNameGeneratorTests method generateBeanNameWithAnonymousComponentYieldsGeneratedBeanName.
@Test
public void generateBeanNameWithAnonymousComponentYieldsGeneratedBeanName() {
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnonymousComponent.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
assertNotNull("The generated beanName must *never* be null.", beanName);
assertTrue("The generated beanName must *never* be blank.", StringUtils.hasText(beanName));
String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd);
assertEquals(expectedGeneratedBeanName, beanName);
}
use of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition in project spring-framework by spring-projects.
the class AnnotationBeanNameGeneratorTests method generateBeanNameFromComposedControllerAnnotationWithBlankName.
/**
* @since 4.0.1
* @see https://jira.spring.io/browse/SPR-11360
*/
@Test
public void generateBeanNameFromComposedControllerAnnotationWithBlankName() {
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComposedControllerAnnotationWithBlankName.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd);
assertEquals(expectedGeneratedBeanName, beanName);
}
use of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition in project spring-framework by spring-projects.
the class AnnotationBeanNameGeneratorTests method generateBeanNameWithDefaultNamedComponent.
@Test
public void generateBeanNameWithDefaultNamedComponent() {
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(DefaultNamedComponent.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
assertNotNull("The generated beanName must *never* be null.", beanName);
assertTrue("The generated beanName must *never* be blank.", StringUtils.hasText(beanName));
assertEquals("thoreau", beanName);
}
use of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition in project spring-framework by spring-projects.
the class AnnotationBeanNameGeneratorTests method generateBeanNameFromComposedControllerAnnotationWithoutName.
/**
* @since 4.0.1
* @see https://jira.spring.io/browse/SPR-11360
*/
@Test
public void generateBeanNameFromComposedControllerAnnotationWithoutName() {
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComposedControllerAnnotationWithoutName.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd);
assertEquals(expectedGeneratedBeanName, beanName);
}
use of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition in project spring-framework by spring-projects.
the class AnnotationBeanNameGeneratorTests method generateBeanNameFromMetaComponentWithStringValue.
@Test
public void generateBeanNameFromMetaComponentWithStringValue() {
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromStringMeta.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
assertEquals("henry", beanName);
}
Aggregations