Package org.springframework.config.java.annotation

Examples of org.springframework.config.java.annotation.Bean


    // contains the beanNames resolved based on the method signature
    final Set<String> noArgMethodsSeen = new HashSet<String>();

    ReflectionUtils.doWithMethods(configurationClass, new MethodCallback() {
      public void doWith(Method m) throws IllegalArgumentException, IllegalAccessException {
        Bean beanAnnotation = AnnotationUtils.findAnnotation(m, Bean.class);
        // Determine bean name
        String beanName = beanNamingStrategy.getBeanName(m);

        if (beanAnnotation != null) {
          if (!noArgMethodsSeen.contains(beanName)) {
            // If the bean already exists in the factory, don't emit
            // a bean definition. This may or may not be legal,
            // depending on whether the @Bean annotation allows
            // overriding
            if (owningBeanFactory.containsLocalBean(beanName)) {
              if (!beanAnnotation.allowOverriding()) {
                String message = format(
                    "A bean named '%s' already exists. Consider using @Bean(allowOverriding=true)",
                    beanName);
                throw new IllegalStateException(message);
              }
View Full Code Here


     * @param m
     * @param c
     * @return
     */
    private boolean shouldProxyBeanCreationMethod(Method m) {
      Bean bean = AnnotationUtils.findAnnotation(m, Bean.class);

      // TODO need to consider autowiring enabled at factory level - reuse
      // the
      // detection from ConfigurationProcessor
      return !m.getReturnType().isInterface() || bean.autowire().isAutowire();
    }
View Full Code Here

TOP

Related Classes of org.springframework.config.java.annotation.Bean

Copyright © 2018 www.massapicom. 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.