Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 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,21 +20,23 @@ import org.springframework.beans.BeansException;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Exception thrown when a {@code BeanFactory} is asked for a bean instance
|
||||
* 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. This may point to a non-existing bean, a non-unique bean,
|
||||
* or a manually registered singleton instance without an associated bean definition.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @see BeanFactory#getBean(String)
|
||||
* @see BeanFactory#getBean(Class)
|
||||
* @see NoUniqueBeanDefinitionException
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class NoSuchBeanDefinitionException extends BeansException {
|
||||
|
||||
/** Name of the missing bean. */
|
||||
/** Name of the missing bean */
|
||||
private String beanName;
|
||||
|
||||
/** Required type of the missing bean. */
|
||||
/** Required type of the missing bean */
|
||||
private Class<?> beanType;
|
||||
|
||||
|
||||
|
||||
@@ -135,14 +135,14 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
/** Map of bean definition objects, keyed by bean name */
|
||||
private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<String, BeanDefinition>(64);
|
||||
|
||||
/** Map of singleton and non-singleton bean names keyed by dependency type */
|
||||
/** Map of singleton and non-singleton bean names, keyed by dependency type */
|
||||
private final Map<Class<?>, String[]> allBeanNamesByType = new ConcurrentHashMap<Class<?>, String[]>(64);
|
||||
|
||||
/** Map of singleton-only bean names keyed by dependency type */
|
||||
/** Map of singleton-only bean names, keyed by dependency type */
|
||||
private final Map<Class<?>, String[]> singletonBeanNamesByType = new ConcurrentHashMap<Class<?>, String[]>(64);
|
||||
|
||||
/** List of bean definition names, in registration order */
|
||||
private final List<String> beanDefinitionNames = new ArrayList<String>();
|
||||
private final List<String> beanDefinitionNames = new ArrayList<String>(64);
|
||||
|
||||
/** Whether bean definition metadata may be cached for all beans */
|
||||
private boolean configurationFrozen = false;
|
||||
|
||||
@@ -1847,21 +1847,21 @@ public class SpelReproTests extends ExpressionTestCase {
|
||||
|
||||
private boolean primitiveProperty = true;
|
||||
|
||||
public Boolean isSimpleProperty() {
|
||||
return simpleProperty;
|
||||
}
|
||||
|
||||
public void setSimpleProperty(Boolean simpleProperty) {
|
||||
this.simpleProperty = simpleProperty;
|
||||
}
|
||||
|
||||
public boolean isPrimitiveProperty() {
|
||||
return primitiveProperty;
|
||||
public Boolean isSimpleProperty() {
|
||||
return this.simpleProperty;
|
||||
}
|
||||
|
||||
public void setPrimitiveProperty(boolean primitiveProperty) {
|
||||
this.primitiveProperty = primitiveProperty;
|
||||
}
|
||||
|
||||
public boolean isPrimitiveProperty() {
|
||||
return this.primitiveProperty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1914,13 +1914,13 @@ public class SpelReproTests extends ExpressionTestCase {
|
||||
|
||||
private String name = "name";
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1932,25 +1932,22 @@ public class SpelReproTests extends ExpressionTestCase {
|
||||
}
|
||||
|
||||
|
||||
static class TestClass2 { // SPR-9194
|
||||
static class TestClass2 { // SPR-9194
|
||||
|
||||
String string;
|
||||
|
||||
|
||||
public TestClass2(String string) {
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
public boolean equals(Object other) {
|
||||
return (this == other || (other instanceof TestClass2 &&
|
||||
this.string.equals(((TestClass2) other).string)));
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof TestClass2) {
|
||||
return string.equals(((TestClass2) o).string);
|
||||
}
|
||||
return false;
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.string.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1964,12 +1961,12 @@ public class SpelReproTests extends ExpressionTestCase {
|
||||
}
|
||||
|
||||
public int parameter() {
|
||||
return counter.incrementAndGet();
|
||||
return this.counter.incrementAndGet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolve(EvaluationContext context, String beanName) throws AccessException {
|
||||
return beanName.equals("bean") ? this : null;
|
||||
return (beanName.equals("bean") ? this : null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -76,7 +76,7 @@ public class DelegatingConnectionFactory
|
||||
/**
|
||||
* Indicate whether Connections obtained from the target factory are supposed
|
||||
* to be stopped before closed ("true") or simply closed ("false").
|
||||
* The latter may be necessary for some connection pools that simply return
|
||||
* An extra stop call may be necessary for some connection pools that simply return
|
||||
* released connections to the pool, not stopping them while they sit in the pool.
|
||||
* <p>Default is "false", simply closing Connections.
|
||||
* @see ConnectionFactoryUtils#releaseConnection
|
||||
|
||||
@@ -73,9 +73,8 @@ import org.springframework.util.Assert;
|
||||
* @see org.springframework.jms.listener.SimpleMessageListenerContainer
|
||||
* @see org.springframework.jms.listener.DefaultMessageListenerContainer#setCacheLevel
|
||||
*/
|
||||
public class SingleConnectionFactory
|
||||
implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, ExceptionListener,
|
||||
InitializingBean, DisposableBean {
|
||||
public class SingleConnectionFactory implements ConnectionFactory, QueueConnectionFactory,
|
||||
TopicConnectionFactory, ExceptionListener, InitializingBean, DisposableBean {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@@ -171,7 +170,7 @@ public class SingleConnectionFactory
|
||||
|
||||
/**
|
||||
* Specify an JMS ExceptionListener implementation that should be
|
||||
* registered with with the single Connection created by this factory.
|
||||
* registered with the single Connection created by this factory.
|
||||
* @see #setReconnectOnException
|
||||
*/
|
||||
public void setExceptionListener(ExceptionListener exceptionListener) {
|
||||
@@ -180,7 +179,7 @@ public class SingleConnectionFactory
|
||||
|
||||
/**
|
||||
* Return the JMS ExceptionListener implementation that should be registered
|
||||
* with with the single Connection created by this factory, if any.
|
||||
* with the single Connection created by this factory, if any.
|
||||
*/
|
||||
protected ExceptionListener getExceptionListener() {
|
||||
return this.exceptionListener;
|
||||
@@ -307,6 +306,7 @@ public class SingleConnectionFactory
|
||||
* The provider of this ConnectionFactory needs to care for proper shutdown.
|
||||
* <p>As this bean implements DisposableBean, a bean factory will
|
||||
* automatically invoke this on destruction of its cached singletons.
|
||||
* @see #resetConnection()
|
||||
*/
|
||||
public void destroy() {
|
||||
resetConnection();
|
||||
@@ -314,6 +314,7 @@ public class SingleConnectionFactory
|
||||
|
||||
/**
|
||||
* Reset the underlying shared Connection, to be reinitialized on next access.
|
||||
* @see #closeConnection
|
||||
*/
|
||||
public void resetConnection() {
|
||||
synchronized (this.connectionMonitor) {
|
||||
|
||||
@@ -127,8 +127,7 @@ public abstract class Log4jWebConfigurer {
|
||||
|
||||
// Leave a URL (e.g. "classpath:" or "file:") as-is.
|
||||
if (!ResourceUtils.isUrl(location)) {
|
||||
// Consider a plain file path as relative to the web
|
||||
// application root directory.
|
||||
// Consider a plain file path as relative to the web application root directory.
|
||||
location = WebUtils.getRealPath(servletContext, location);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.apache.tiles.request.servlet.ServletApplicationContext;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.context.support.ServletContextResourcePatternResolver;
|
||||
|
||||
@@ -53,22 +54,20 @@ public class SpringWildcardServletTilesApplicationContext extends ServletApplica
|
||||
|
||||
@Override
|
||||
public ApplicationResource getResource(String localePath) {
|
||||
ApplicationResource retValue = null;
|
||||
Collection<ApplicationResource> urlSet = getResources(localePath);
|
||||
if (urlSet != null && !urlSet.isEmpty()) {
|
||||
retValue = urlSet.iterator().next();
|
||||
if (!CollectionUtils.isEmpty(urlSet)) {
|
||||
return urlSet.iterator().next();
|
||||
}
|
||||
return retValue;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationResource getResource(ApplicationResource base, Locale locale) {
|
||||
ApplicationResource retValue = null;
|
||||
Collection<ApplicationResource> urlSet = getResources(base.getLocalePath(locale));
|
||||
if (urlSet != null && !urlSet.isEmpty()) {
|
||||
retValue = urlSet.iterator().next();
|
||||
if (!CollectionUtils.isEmpty(urlSet)) {
|
||||
return urlSet.iterator().next();
|
||||
}
|
||||
return retValue;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,6 +49,7 @@ public class SpringTilesApplicationContextFactory extends AbstractTilesApplicati
|
||||
|
||||
private Map<String, String> params;
|
||||
|
||||
|
||||
public void init(Map<String, String> params) {
|
||||
this.params = params;
|
||||
}
|
||||
@@ -89,12 +90,11 @@ public class SpringTilesApplicationContextFactory extends AbstractTilesApplicati
|
||||
|
||||
@Override
|
||||
public URL getResource(String path) throws IOException {
|
||||
URL retValue = null;
|
||||
Set<URL> urlSet = getResources(path);
|
||||
if (!CollectionUtils.isEmpty(urlSet)) {
|
||||
retValue = urlSet.iterator().next();
|
||||
return urlSet.iterator().next();
|
||||
}
|
||||
return retValue;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user