Skip to content

Commit 10d4888

Browse files
committed
Polishing
1 parent f8b729a commit 10d4888

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

spring-context/src/test/java/org/springframework/context/support/SimpleThreadScopeTests.java

+6-9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.context.support;
1818

1919
import org.junit.Test;
20+
2021
import org.springframework.context.ApplicationContext;
2122
import org.springframework.tests.sample.beans.TestBean;
2223

@@ -28,8 +29,9 @@
2829
*/
2930
public class SimpleThreadScopeTests {
3031

31-
private ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
32-
"simpleThreadScopeTests.xml", getClass());
32+
private final ApplicationContext applicationContext =
33+
new ClassPathXmlApplicationContext("simpleThreadScopeTests.xml", getClass());
34+
3335

3436
@Test
3537
public void getFromScope() throws Exception {
@@ -45,19 +47,15 @@ public void getFromScope() throws Exception {
4547
public void getMultipleInstances() throws Exception {
4648
final TestBean[] beans = new TestBean[2];
4749
Thread thread1 = new Thread(new Runnable() {
48-
4950
@Override
5051
public void run() {
51-
beans[0] = applicationContext.getBean("threadScopedObject",
52-
TestBean.class);
52+
beans[0] = applicationContext.getBean("threadScopedObject", TestBean.class);
5353
}
5454
});
5555
Thread thread2 = new Thread(new Runnable() {
56-
5756
@Override
5857
public void run() {
59-
beans[1] = applicationContext.getBean("threadScopedObject",
60-
TestBean.class);
58+
beans[1] = applicationContext.getBean("threadScopedObject", TestBean.class);
6159
}
6260
});
6361
thread1.start();
@@ -67,7 +65,6 @@ public void run() {
6765

6866
assertNotNull(beans[0]);
6967
assertNotNull(beans[1]);
70-
7168
assertNotSame(beans[0], beans[1]);
7269
}
7370

0 commit comments

Comments
 (0)