本文整理了Java中org.springframework.web.context.WebApplicationContext.getClassLoader()
方法的一些代码示例,展示了WebApplicationContext.getClassLoader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebApplicationContext.getClassLoader()
方法的具体详情如下:
包路径:org.springframework.web.context.WebApplicationContext
类名称:WebApplicationContext
方法名:getClassLoader
暂无
代码示例来源:origin: spring-projects/spring-framework
@Override
protected ViewPreparer getPreparer(String name, WebApplicationContext context) throws TilesException {
// Quick check on the concurrent map first, with minimal locking.
ViewPreparer preparer = this.sharedPreparers.get(name);
if (preparer == null) {
synchronized (this.sharedPreparers) {
preparer = this.sharedPreparers.get(name);
if (preparer == null) {
try {
Class<?> beanClass = ClassUtils.forName(name, context.getClassLoader());
if (!ViewPreparer.class.isAssignableFrom(beanClass)) {
throw new PreparerException(
"Invalid preparer class [" + name + "]: does not implement ViewPreparer interface");
}
preparer = (ViewPreparer) context.getAutowireCapableBeanFactory().createBean(beanClass);
this.sharedPreparers.put(name, preparer);
}
catch (ClassNotFoundException ex) {
throw new NoSuchPreparerException("Preparer class [" + name + "] not found", ex);
}
}
}
}
return preparer;
}
代码示例来源:origin: org.springframework/spring-webmvc
@Override
protected ViewPreparer getPreparer(String name, WebApplicationContext context) throws TilesException {
// Quick check on the concurrent map first, with minimal locking.
ViewPreparer preparer = this.sharedPreparers.get(name);
if (preparer == null) {
synchronized (this.sharedPreparers) {
preparer = this.sharedPreparers.get(name);
if (preparer == null) {
try {
Class<?> beanClass = ClassUtils.forName(name, context.getClassLoader());
if (!ViewPreparer.class.isAssignableFrom(beanClass)) {
throw new PreparerException(
"Invalid preparer class [" + name + "]: does not implement ViewPreparer interface");
}
preparer = (ViewPreparer) context.getAutowireCapableBeanFactory().createBean(beanClass);
this.sharedPreparers.put(name, preparer);
}
catch (ClassNotFoundException ex) {
throw new NoSuchPreparerException("Preparer class [" + name + "] not found", ex);
}
}
}
}
return preparer;
}
代码示例来源:origin: webx/citrus
private Map<String, RequestHandler> loadInternalHandlers(String location) {
ClassLoader loader = components.getParentApplicationContext().getClassLoader();
Properties handlerNames;
代码示例来源:origin: webx/citrus
private Map<String, RequestHandler> loadInternalHandlers(String location) {
ClassLoader loader = components.getParentApplicationContext().getClassLoader();
Properties handlerNames;
代码示例来源:origin: org.apache.cocoon/cocoon-sitemap-impl
/** Set the processor data, result of the treebuilder job */
public void setProcessorData(WebApplicationContext webAppContext,
ProcessingNode rootNode,
List disposableNodes,
List enterSitemapEventListeners,
List leaveSitemapEventListeners) {
if (this.rootNode != null) {
throw new IllegalStateException("setProcessorData() can only be called once");
}
this.classLoader = webAppContext.getClassLoader();
this.webAppContext = webAppContext;
this.manager = (ServiceManager)this.webAppContext.getBean(AvalonUtils.SERVICE_MANAGER_ROLE);
this.rootNode = rootNode;
this.disposableNodes = disposableNodes;
this.enterSitemapEventListeners = enterSitemapEventListeners;
this.leaveSitemapEventListeners = leaveSitemapEventListeners;
}
代码示例来源:origin: org.apache.cocoon/cocoon-spring-configurator
/**
* Notify about entering this context.
*
* @param webAppContext The current web application context.
* @return A handle which should be passed to {@link #leavingContext(WebApplicationContext, Object)}.
*/
public static Object enteringContext(WebApplicationContext webAppContext) {
// get request attributes
final RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
// save current class loader and web application context
final ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
final WebApplicationContext oldContext = (WebApplicationContext) attributes.getAttribute(CONTAINER_REQUEST_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST);
// set new class loader and context
attributes.setAttribute(CONTAINER_REQUEST_ATTRIBUTE, webAppContext, RequestAttributes.SCOPE_REQUEST);
Thread.currentThread().setContextClassLoader(webAppContext.getClassLoader());
return new ContextInfo(oldContext, oldClassLoader);
}
代码示例来源:origin: spring-projects/spring-framework-issues
@Override
protected ViewPreparer getPreparer(String name, WebApplicationContext context) throws TilesException {
// Quick check on the concurrent map first, with minimal locking.
ViewPreparer preparer = this.sharedPreparers.get(name);
if (preparer == null) {
synchronized (this.sharedPreparers) {
preparer = this.sharedPreparers.get(name);
if (preparer == null) {
try {
Class<?> beanClass = context.getClassLoader().loadClass(name);
if (!ViewPreparer.class.isAssignableFrom(beanClass)) {
throw new PreparerException(
"Invalid preparer class [" + name + "]: does not implement ViewPreparer interface");
}
preparer = (ViewPreparer) context.getAutowireCapableBeanFactory().createBean(beanClass);
this.sharedPreparers.put(name, preparer);
}
catch (ClassNotFoundException ex) {
throw new NoSuchPreparerException("Preparer class [" + name + "] not found", ex);
}
}
}
}
return preparer;
}
代码示例来源:origin: apache/servicemix-bundles
@Override
protected ViewPreparer getPreparer(String name, WebApplicationContext context) throws TilesException {
// Quick check on the concurrent map first, with minimal locking.
ViewPreparer preparer = this.sharedPreparers.get(name);
if (preparer == null) {
synchronized (this.sharedPreparers) {
preparer = this.sharedPreparers.get(name);
if (preparer == null) {
try {
Class<?> beanClass = context.getClassLoader().loadClass(name);
if (!ViewPreparer.class.isAssignableFrom(beanClass)) {
throw new PreparerException(
"Invalid preparer class [" + name + "]: does not implement ViewPreparer interface");
}
preparer = (ViewPreparer) context.getAutowireCapableBeanFactory().createBean(beanClass);
this.sharedPreparers.put(name, preparer);
}
catch (ClassNotFoundException ex) {
throw new NoSuchPreparerException("Preparer class [" + name + "] not found", ex);
}
}
}
}
return preparer;
}
代码示例来源:origin: apache/servicemix-bundles
@Override
protected ViewPreparer getPreparer(String name, WebApplicationContext context) throws TilesException {
// Quick check on the concurrent map first, with minimal locking.
ViewPreparer preparer = this.sharedPreparers.get(name);
if (preparer == null) {
synchronized (this.sharedPreparers) {
preparer = this.sharedPreparers.get(name);
if (preparer == null) {
try {
Class<?> beanClass = context.getClassLoader().loadClass(name);
if (!ViewPreparer.class.isAssignableFrom(beanClass)) {
throw new PreparerException(
"Invalid preparer class [" + name + "]: does not implement ViewPreparer interface");
}
preparer = (ViewPreparer) context.getAutowireCapableBeanFactory().createBean(beanClass);
this.sharedPreparers.put(name, preparer);
}
catch (ClassNotFoundException ex) {
throw new NoSuchPreparerException("Preparer class [" + name + "] not found", ex);
}
}
}
}
return preparer;
}
代码示例来源:origin: com.alibaba.citrus/citrus-webx-all
private Map<String, RequestHandler> loadInternalHandlers(String location) {
ClassLoader loader = components.getParentApplicationContext().getClassLoader();
Properties handlerNames;
内容来源于网络,如有侵权,请联系作者删除!