当前位置: 首页>>代码示例>>Java>>正文


Java BeansException.getMessage方法代码示例

本文整理汇总了Java中org.springframework.beans.BeansException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java BeansException.getMessage方法的具体用法?Java BeansException.getMessage怎么用?Java BeansException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.beans.BeansException的用法示例。


在下文中一共展示了BeansException.getMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.springframework.beans.BeansException; //导入方法依赖的package包/类
/**
 * Standard way of initializing this filter.
 * Map config parameters onto bean properties of this filter, and
 * invoke subclass initialization.
 * @param filterConfig the configuration for this filter
 * @throws ServletException if bean properties are invalid (or required
 * properties are missing), or if subclass initialization fails.
 * @see #initFilterBean
 */
@Override
public final void init(FilterConfig filterConfig) throws ServletException {
	Assert.notNull(filterConfig, "FilterConfig must not be null");
	if (logger.isDebugEnabled()) {
		logger.debug("Initializing filter '" + filterConfig.getFilterName() + "'");
	}

	this.filterConfig = filterConfig;

	// Set bean properties from init parameters.
	try {
		PropertyValues pvs = new FilterConfigPropertyValues(filterConfig, this.requiredProperties);
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
		ResourceLoader resourceLoader = new ServletContextResourceLoader(filterConfig.getServletContext());
		bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader, this.environment));
		initBeanWrapper(bw);
		bw.setPropertyValues(pvs, true);
	}
	catch (BeansException ex) {
		String msg = "Failed to set bean properties on filter '" +
			filterConfig.getFilterName() + "': " + ex.getMessage();
		logger.error(msg, ex);
		throw new NestedServletException(msg, ex);
	}

	// Let subclasses do whatever initialization they like.
	initFilterBean();

	if (logger.isDebugEnabled()) {
		logger.debug("Filter '" + filterConfig.getFilterName() + "' configured successfully");
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:42,代码来源:GenericFilterBean.java

示例2: createServiceLocatorException

import org.springframework.beans.BeansException; //导入方法依赖的package包/类
/**
 * Create a service locator exception for the given cause.
 * Only called in case of a custom service locator exception.
 * <p>The default implementation can handle all variations of
 * message and exception arguments.
 * @param exceptionConstructor the constructor to use
 * @param cause the cause of the service lookup failure
 * @return the service locator exception to throw
 * @see #setServiceLocatorExceptionClass
 */
protected Exception createServiceLocatorException(Constructor<Exception> exceptionConstructor, BeansException cause) {
	Class<?>[] paramTypes = exceptionConstructor.getParameterTypes();
	Object[] args = new Object[paramTypes.length];
	for (int i = 0; i < paramTypes.length; i++) {
		if (paramTypes[i].equals(String.class)) {
			args[i] = cause.getMessage();
		}
		else if (paramTypes[i].isInstance(cause)) {
			args[i] = cause;
		}
	}
	return BeanUtils.instantiateClass(exceptionConstructor, args);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:ServiceLocatorFactoryBean.java

示例3: UnsatisfiedDependencyException

import org.springframework.beans.BeansException; //导入方法依赖的package包/类
/**
 * Create a new UnsatisfiedDependencyException.
 * @param resourceDescription description of the resource that the bean definition came from
 * @param beanName the name of the bean requested
 * @param propertyName the name of the bean property that couldn't be satisfied
 * @param ex the bean creation exception that indicated the unsatisfied dependency
 */
public UnsatisfiedDependencyException(
		String resourceDescription, String beanName, String propertyName, BeansException ex) {

	this(resourceDescription, beanName, propertyName, (ex != null ? ": " + ex.getMessage() : ""));
	initCause(ex);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:UnsatisfiedDependencyException.java


注:本文中的org.springframework.beans.BeansException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。