diff --git a/spring-context/src/main/java/org/springframework/context/support/SimpleThreadScope.java b/spring-context/src/main/java/org/springframework/context/support/SimpleThreadScope.java
index 30aad8a078b..00be39f0625 100644
--- a/spring-context/src/main/java/org/springframework/context/support/SimpleThreadScope.java
+++ b/spring-context/src/main/java/org/springframework/context/support/SimpleThreadScope.java
@@ -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.
@@ -27,14 +27,17 @@ import org.springframework.beans.factory.config.Scope;
import org.springframework.core.NamedThreadLocal;
/**
- * Thread-backed {@link Scope} implementation.
+ * A simple thread-backed {@link Scope} implementation.
*
- *
Note that the {@code SimpleThreadScope} does not clean up any objects associated
- * with it. As such, it's typically preferable to use the {@link org.springframework.web.context.request.RequestScope}
- * in Web environments.
+ *
Note: {@code SimpleThreadScope} does not clean up
+ * any objects associated with it. As such, it is typically preferable to
+ * use {@link org.springframework.web.context.request.RequestScope RequestScope}
+ * in web environments.
*
- *
For a implementation of a thread-based {@code Scope} with support for destruction callbacks, refer to this module.
+ *
Thanks to Eugene Kuleshov for submitting the original prototype for a thread scope!
*
@@ -55,8 +58,9 @@ public class SimpleThreadScope implements Scope {
}
};
- public Object get(String name, ObjectFactory objectFactory) {
- Map scope = threadScope.get();
+
+ public Object get(String name, ObjectFactory> objectFactory) {
+ Map scope = this.threadScope.get();
Object object = scope.get(name);
if (object == null) {
object = objectFactory.getObject();
@@ -66,13 +70,13 @@ public class SimpleThreadScope implements Scope {
}
public Object remove(String name) {
- Map scope = threadScope.get();
+ Map scope = this.threadScope.get();
return scope.remove(name);
}
public void registerDestructionCallback(String name, Runnable callback) {
- logger.warn("SimpleThreadScope does not support descruction callbacks. " +
- "Consider using a RequestScope in a Web environment.");
+ logger.warn("SimpleThreadScope does not support destruction callbacks. " +
+ "Consider using RequestScope in a web environment.");
}
public Object resolveContextualObject(String key) {
diff --git a/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java
index 4283d5b3f4e..08f14a28b93 100644
--- a/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java
+++ b/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java
@@ -16,18 +16,13 @@
package org.springframework.aop.framework;
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
import java.io.Serializable;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Test;
+import test.mixin.LockMixinAdvisor;
+
import org.springframework.aop.ClassFilter;
import org.springframework.aop.MethodMatcher;
import org.springframework.aop.Pointcut;
@@ -42,10 +37,11 @@ import org.springframework.tests.aop.interceptor.NopInterceptor;
import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
-import test.mixin.LockMixinAdvisor;
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
/**
- * Additional and overridden tests for the CGLIB proxy.
+ * Additional and overridden tests for CGLIB proxies.
*
* @author Rod Johnson
* @author Juergen Hoeller
@@ -56,7 +52,8 @@ import test.mixin.LockMixinAdvisor;
@SuppressWarnings("serial")
public final class CglibProxyTests extends AbstractAopProxyTests implements Serializable {
- private static final String DEPENDENCY_CHECK_CONTEXT = CglibProxyTests.class.getSimpleName() + "-with-dependency-checking.xml";
+ private static final String DEPENDENCY_CHECK_CONTEXT =
+ CglibProxyTests.class.getSimpleName() + "-with-dependency-checking.xml";
@Override
@@ -354,7 +351,6 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
@Test
public void testAddAdviceAtRuntime() {
TestBean bean = new TestBean();
-
CountingBeforeAdvice cba = new CountingBeforeAdvice();
ProxyFactory pf = new ProxyFactory();
@@ -364,17 +360,13 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
pf.setProxyTargetClass(true);
TestBean proxy = (TestBean) pf.getProxy();
-
assertTrue(AopUtils.isCglibProxy(proxy));
proxy.getAge();
-
assertEquals(0, cba.getCalls());
((Advised) proxy).addAdvice(cba);
-
proxy.getAge();
-
assertEquals(1, cba.getCalls());
}
@@ -386,7 +378,6 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
proxyFactory.setProxyTargetClass(true);
MyBean proxy = (MyBean) proxyFactory.getProxy();
-
assertEquals(4, proxy.add(1, 3));
assertEquals(1, advice.getCalls("add"));
}
@@ -444,7 +435,6 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
public final void foo() {
}
}
-
}
@@ -481,7 +471,6 @@ class NoArgCtorTestBean {
public void reset() {
called = false;
}
-
}
@@ -490,15 +479,11 @@ class ProtectedMethodTestBean {
protected String getString() {
return "foo";
}
-
}
class UnsupportedInterceptor implements MethodInterceptor {
- /**
- * @see org.aopalliance.intercept.MethodInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
- */
@Override
public Object invoke(MethodInvocation mi) throws Throwable {
throw new UnsupportedOperationException(mi.getMethod().getName());
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java
index 6db102fc64f..0c41df7cc52 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java
@@ -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.
@@ -311,8 +311,7 @@ public interface JdbcOperations {
* @return a result object returned by the action, or {@code null}
* @throws DataAccessException if there is any problem
*/
- T execute(PreparedStatementCreator psc, PreparedStatementCallback action)
- throws DataAccessException;
+ T execute(PreparedStatementCreator psc, PreparedStatementCallback action) throws DataAccessException;
/**
* Execute a JDBC data access operation, implemented as callback action
@@ -354,8 +353,7 @@ public interface JdbcOperations {
* @return an arbitrary result object, as returned by the ResultSetExtractor
* @throws DataAccessException if there is any problem
*/
- T query(String sql, PreparedStatementSetter pss, ResultSetExtractor rse)
- throws DataAccessException;
+ T query(String sql, PreparedStatementSetter pss, ResultSetExtractor rse) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a list
@@ -370,8 +368,7 @@ public interface JdbcOperations {
* @throws DataAccessException if the query fails
* @see java.sql.Types
*/
- T query(String sql, Object[] args, int[] argTypes, ResultSetExtractor rse)
- throws DataAccessException;
+ T query(String sql, Object[] args, int[] argTypes, ResultSetExtractor rse) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a list
@@ -428,8 +425,7 @@ public interface JdbcOperations {
* @param rch object that will extract results, one row at a time
* @throws DataAccessException if the query fails
*/
- void query(String sql, PreparedStatementSetter pss, RowCallbackHandler rch)
- throws DataAccessException;
+ void query(String sql, PreparedStatementSetter pss, RowCallbackHandler rch) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a list of
@@ -443,8 +439,7 @@ public interface JdbcOperations {
* @throws DataAccessException if the query fails
* @see java.sql.Types
*/
- void query(String sql, Object[] args, int[] argTypes, RowCallbackHandler rch)
- throws DataAccessException;
+ void query(String sql, Object[] args, int[] argTypes, RowCallbackHandler rch) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a list of
@@ -500,8 +495,7 @@ public interface JdbcOperations {
* @return the result List, containing mapped objects
* @throws DataAccessException if the query fails
*/
- List query(String sql, PreparedStatementSetter pss, RowMapper rowMapper)
- throws DataAccessException;
+ List query(String sql, PreparedStatementSetter pss, RowMapper rowMapper) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a list
@@ -516,8 +510,7 @@ public interface JdbcOperations {
* @throws DataAccessException if the query fails
* @see java.sql.Types
*/
- List query(String sql, Object[] args, int[] argTypes, RowMapper rowMapper)
- throws DataAccessException;
+ List query(String sql, Object[] args, int[] argTypes, RowMapper rowMapper) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a list
@@ -582,8 +575,7 @@ public interface JdbcOperations {
* return exactly one row
* @throws DataAccessException if the query fails
*/
- T queryForObject(String sql, Object[] args, RowMapper rowMapper)
- throws DataAccessException;
+ T queryForObject(String sql, Object[] args, RowMapper rowMapper) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a list
@@ -600,8 +592,7 @@ public interface JdbcOperations {
* return exactly one row
* @throws DataAccessException if the query fails
*/
- T queryForObject(String sql, RowMapper rowMapper, Object... args)
- throws DataAccessException;
+ T queryForObject(String sql, RowMapper rowMapper, Object... args) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
@@ -1009,7 +1000,7 @@ public interface JdbcOperations {
* @param batchArgs the List of Object arrays containing the batch of arguments for the query
* @return an array containing the numbers of rows affected by each update in the batch
*/
- public int[] batchUpdate(String sql, List