Examples of AnnotatedBeanDefinition


Examples of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition

   * (non-Javadoc)
   * @see org.springframework.beans.factory.support.BeanNameGenerator#generateBeanName(org.springframework.beans.factory.config.BeanDefinition, org.springframework.beans.factory.support.BeanDefinitionRegistry)
   */
  public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {

    AnnotatedBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(getRepositoryInterfaceFrom(definition));
    return DELEGATE.generateBeanName(beanDefinition, registry);
  }
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition


  public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) {
    ScopeMetadata metadata = new ScopeMetadata();
    if (definition instanceof AnnotatedBeanDefinition) {
      AnnotatedBeanDefinition annDef = (AnnotatedBeanDefinition) definition;
      Map<String, Object> attributes =
          annDef.getMetadata().getAnnotationAttributes(this.scopeAnnotationType.getName());
      if (attributes != null) {
        metadata.setScopeName((String) attributes.get("value"));
        ScopedProxyMode proxyMode = (ScopedProxyMode) attributes.get("proxyMode");
        if (proxyMode == null || proxyMode == ScopedProxyMode.DEFAULT) {
          proxyMode = this.defaultProxyMode;
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition


  public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) {
    ScopeMetadata metadata = new ScopeMetadata();
    if (definition instanceof AnnotatedBeanDefinition) {
      AnnotatedBeanDefinition annDef = (AnnotatedBeanDefinition) definition;
      AnnotationAttributes attributes =
          attributesFor(annDef.getMetadata(), this.scopeAnnotationType);
      if (attributes != null) {
        metadata.setScopeName(attributes.getString("value"));
        ScopedProxyMode proxyMode = attributes.getEnum("proxyMode");
        if (proxyMode == null || proxyMode == ScopedProxyMode.DEFAULT) {
          proxyMode = this.defaultProxyMode;
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition

 

  public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) {
    ScopeMetadata metadata = new ScopeMetadata();
    if (definition instanceof AnnotatedBeanDefinition) {
      AnnotatedBeanDefinition annDef = (AnnotatedBeanDefinition) definition;
      Map<String, Object> attributes =
          annDef.getMetadata().getAnnotationAttributes(this.scopeAnnotationType.getName());
      if (attributes != null) {
        metadata.setScopeName((String) attributes.get("value"));
      }
      if (!metadata.getScopeName().equals(BeanDefinition.SCOPE_SINGLETON)) {
        metadata.setScopedProxyMode(this.scopedProxyMode);
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition

   * @throws ClassNotFoundException
   */
  protected void postProcessBeanDefinition(AbstractBeanDefinition beanDefinition, String beanName) {
    super.postProcessBeanDefinition(beanDefinition, beanName);
    if (beanDefinition instanceof AnnotatedBeanDefinition) {
      final AnnotatedBeanDefinition abd = (AnnotatedBeanDefinition) beanDefinition;
      final AnnotationMetadata amd = abd.getMetadata();
      if (amd.hasAnnotation("org.springframework.stereotype.Controller")) {
        //register @AppliedTo
        BeanDefinition forbd = null;
        String forBean = null;
        if (amd.hasAnnotation("org.zkoss.spring.context.annotation.AppliedTo")) {
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition

  public void testGenerateBeanNameWithNamedComponent() {
    MockControl control = MockControl.createControl(BeanDefinitionRegistry.class);
    BeanDefinitionRegistry registry = (BeanDefinitionRegistry) control.getMock();
    control.replay();

    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentWithName.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("walden", beanName);

View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition

  public void testGenerateBeanNameWithDefaultNamedComponent() {
    MockControl control = MockControl.createControl(BeanDefinitionRegistry.class);
    BeanDefinitionRegistry registry = (BeanDefinitionRegistry) control.getMock();
    control.replay();

    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);

View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition

  public void testGenerateBeanNameWithNamedComponentWhereTheNameIsBlank() {
    MockControl control = MockControl.createControl(BeanDefinitionRegistry.class);
    BeanDefinitionRegistry registry = (BeanDefinitionRegistry) control.getMock();
    control.replay();

    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentWithBlankName.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);
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition

  public void testGenerateBeanNameWithAnonymousComponentYieldsGeneratedBeanName() {
    MockControl control = MockControl.createControl(BeanDefinitionRegistry.class);
    BeanDefinitionRegistry registry = (BeanDefinitionRegistry) control.getMock();
    control.replay();

    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);
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition

    this.scopeMetadataResolver = new AnnotationScopeMetadataResolver();
  }


  public void testThatResolveScopeMetadataDoesNotApplyScopedProxyModeToASingleton() {
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithSingletonScope.class);
    ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
    assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata);
    assertEquals(BeanDefinition.SCOPE_SINGLETON, scopeMetadata.getScopeName());
    assertEquals(ScopedProxyMode.NO, scopeMetadata.getScopedProxyMode());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.