diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java b/spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java index e8d929f348b..74620895566 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,23 +20,24 @@ import org.springframework.beans.BeansException; import org.springframework.util.StringUtils; /** - * Exception thrown when a BeanFactory is asked for a bean - * instance name for which it cannot find a definition. + * Exception thrown when a {@code BeanFactory} is asked for a bean + * instance for which it cannot find a definition. * * @author Rod Johnson * @author Juergen Hoeller */ +@SuppressWarnings("serial") public class NoSuchBeanDefinitionException extends BeansException { - /** Name of the missing bean */ + /** Name of the missing bean. */ private String beanName; - /** Required bean type */ - private Class beanType; + /** Required type of the missing bean. */ + private Class beanType; /** - * Create a new NoSuchBeanDefinitionException. + * Create a new {@code NoSuchBeanDefinitionException}. * @param name the name of the missing bean */ public NoSuchBeanDefinitionException(String name) { @@ -45,7 +46,7 @@ public class NoSuchBeanDefinitionException extends BeansException { } /** - * Create a new NoSuchBeanDefinitionException. + * Create a new {@code NoSuchBeanDefinitionException}. * @param name the name of the missing bean * @param message detailed message describing the problem */ @@ -55,31 +56,31 @@ public class NoSuchBeanDefinitionException extends BeansException { } /** - * Create a new NoSuchBeanDefinitionException. - * @param type required type of bean + * Create a new {@code NoSuchBeanDefinitionException}. + * @param type required type of the missing bean */ - public NoSuchBeanDefinitionException(Class type) { + public NoSuchBeanDefinitionException(Class type) { super("No unique bean of type [" + type.getName() + "] is defined"); this.beanType = type; } /** - * Create a new NoSuchBeanDefinitionException. - * @param type required type of bean + * Create a new {@code NoSuchBeanDefinitionException}. + * @param type required type of the missing bean * @param message detailed message describing the problem */ - public NoSuchBeanDefinitionException(Class type, String message) { + public NoSuchBeanDefinitionException(Class type, String message) { super("No unique bean of type [" + type.getName() + "] is defined: " + message); this.beanType = type; } /** - * Create a new NoSuchBeanDefinitionException. - * @param type required type of bean + * Create a new {@code NoSuchBeanDefinitionException}. + * @param type required type of the missing bean * @param dependencyDescription a description of the originating dependency * @param message detailed message describing the problem */ - public NoSuchBeanDefinitionException(Class type, String dependencyDescription, String message) { + public NoSuchBeanDefinitionException(Class type, String dependencyDescription, String message) { super("No matching bean of type [" + type.getName() + "] found for dependency" + (StringUtils.hasLength(dependencyDescription) ? " [" + dependencyDescription + "]" : "") + ": " + message); @@ -88,18 +89,18 @@ public class NoSuchBeanDefinitionException extends BeansException { /** - * Return the name of the missing bean, - * if it was a lookup by name that failed. + * Return the name of the missing bean, if it was a lookup by name + * that failed. */ public String getBeanName() { return this.beanName; } /** - * Return the required type of bean, - * if it was a lookup by type that failed. + * Return the required type of the missing bean, if it was a lookup + * by type that failed. */ - public Class getBeanType() { + public Class getBeanType() { return this.beanType; }