Skip to content

Commit 7c33c70

Browse files
committed
Polishing
1 parent 81c1b60 commit 7c33c70

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

gradle/ide.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ eclipse.classpath.file.whenMerged { classpath ->
2929
classpath.entries.removeAll { entry -> (entry.path =~ /(?!.*?repack.*\.jar).*?\/([^\/]+)\/build\/libs\/[^\/]+\.jar/) }
3030
}
3131

32-
3332
// Use separate main/test outputs (prevents WTP from packaging test classes)
3433
eclipse.classpath.defaultOutputDir = file(project.name+"/bin/eclipse")
3534
eclipse.classpath.file.beforeMerged { classpath ->
3635
classpath.entries.findAll{ it instanceof SourceFolder }.each {
37-
if(it.output.startsWith("bin/")) {
36+
if (it.output.startsWith("bin/")) {
3837
it.output = null
3938
}
4039
}

spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ public class BeanFactoryUtilsTests {
6363

6464

6565
@BeforeEach
66-
public void setUp() {
66+
public void setup() {
6767
// Interesting hierarchical factory to test counts.
68-
// Slow to read so we cache it.
6968

7069
DefaultListableBeanFactory grandParent = new DefaultListableBeanFactory();
7170
new XmlBeanDefinitionReader(grandParent).loadBeanDefinitions(ROOT_CONTEXT);
@@ -93,22 +92,22 @@ public void testHierarchicalCountBeansWithNonHierarchicalFactory() {
9392
* Check that override doesn't count as two separate beans.
9493
*/
9594
@Test
96-
public void testHierarchicalCountBeansWithOverride() throws Exception {
95+
public void testHierarchicalCountBeansWithOverride() {
9796
// Leaf count
9897
assertThat(this.listableBeanFactory.getBeanDefinitionCount() == 1).isTrue();
9998
// Count minus duplicate
10099
assertThat(BeanFactoryUtils.countBeansIncludingAncestors(this.listableBeanFactory) == 8).as("Should count 8 beans, not " + BeanFactoryUtils.countBeansIncludingAncestors(this.listableBeanFactory)).isTrue();
101100
}
102101

103102
@Test
104-
public void testHierarchicalNamesWithNoMatch() throws Exception {
103+
public void testHierarchicalNamesWithNoMatch() {
105104
List<String> names = Arrays.asList(
106105
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.listableBeanFactory, NoOp.class));
107106
assertThat(names.size()).isEqualTo(0);
108107
}
109108

110109
@Test
111-
public void testHierarchicalNamesWithMatchOnlyInRoot() throws Exception {
110+
public void testHierarchicalNamesWithMatchOnlyInRoot() {
112111
List<String> names = Arrays.asList(
113112
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.listableBeanFactory, IndexedTestBean.class));
114113
assertThat(names.size()).isEqualTo(1);
@@ -118,7 +117,7 @@ public void testHierarchicalNamesWithMatchOnlyInRoot() throws Exception {
118117
}
119118

120119
@Test
121-
public void testGetBeanNamesForTypeWithOverride() throws Exception {
120+
public void testGetBeanNamesForTypeWithOverride() {
122121
List<String> names = Arrays.asList(
123122
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.listableBeanFactory, ITestBean.class));
124123
// includes 2 TestBeans from FactoryBeans (DummyFactory definitions)
@@ -236,7 +235,7 @@ public void testFindsBeansOfTypeWithDefaultFactory() {
236235
}
237236

238237
@Test
239-
public void testHierarchicalResolutionWithOverride() throws Exception {
238+
public void testHierarchicalResolutionWithOverride() {
240239
Object test3 = this.listableBeanFactory.getBean("test3");
241240
Object test = this.listableBeanFactory.getBean("test");
242241

@@ -276,14 +275,14 @@ public void testHierarchicalResolutionWithOverride() throws Exception {
276275
}
277276

278277
@Test
279-
public void testHierarchicalNamesForAnnotationWithNoMatch() throws Exception {
278+
public void testHierarchicalNamesForAnnotationWithNoMatch() {
280279
List<String> names = Arrays.asList(
281280
BeanFactoryUtils.beanNamesForAnnotationIncludingAncestors(this.listableBeanFactory, Override.class));
282281
assertThat(names.size()).isEqualTo(0);
283282
}
284283

285284
@Test
286-
public void testHierarchicalNamesForAnnotationWithMatchOnlyInRoot() throws Exception {
285+
public void testHierarchicalNamesForAnnotationWithMatchOnlyInRoot() {
287286
List<String> names = Arrays.asList(
288287
BeanFactoryUtils.beanNamesForAnnotationIncludingAncestors(this.listableBeanFactory, TestAnnotation.class));
289288
assertThat(names.size()).isEqualTo(1);
@@ -293,7 +292,7 @@ public void testHierarchicalNamesForAnnotationWithMatchOnlyInRoot() throws Excep
293292
}
294293

295294
@Test
296-
public void testGetBeanNamesForAnnotationWithOverride() throws Exception {
295+
public void testGetBeanNamesForAnnotationWithOverride() {
297296
AnnotatedBean annotatedBean = new AnnotatedBean();
298297
this.listableBeanFactory.registerSingleton("anotherAnnotatedBean", annotatedBean);
299298
List<String> names = Arrays.asList(
@@ -433,6 +432,7 @@ public void isSingletonAndIsPrototypeWithStaticFactory() {
433432
String basePackage() default "";
434433
}
435434

435+
436436
@Retention(RetentionPolicy.RUNTIME)
437437
@ControllerAdvice
438438
@interface RestControllerAdvice {
@@ -444,18 +444,23 @@ public void isSingletonAndIsPrototypeWithStaticFactory() {
444444
String basePackage() default "";
445445
}
446446

447+
447448
@ControllerAdvice("com.example")
448449
static class ControllerAdviceClass {
449450
}
450451

452+
451453
@RestControllerAdvice("com.example")
452454
static class RestControllerAdviceClass {
453455
}
454456

457+
455458
static class TestBeanSmartFactoryBean implements SmartFactoryBean<TestBean> {
456459

457460
private final TestBean testBean = new TestBean("enigma", 42);
461+
458462
private final boolean singleton;
463+
459464
private final boolean prototype;
460465

461466
TestBeanSmartFactoryBean(boolean singleton, boolean prototype) {
@@ -478,7 +483,7 @@ public Class<TestBean> getObjectType() {
478483
return TestBean.class;
479484
}
480485

481-
public TestBean getObject() throws Exception {
486+
public TestBean getObject() {
482487
// We don't really care if the actual instance is a singleton or prototype
483488
// for the tests that use this factory.
484489
return this.testBean;

src/docs/asciidoc/languages/dynamic-languages.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The following example defines a class that has a dependency on the `Messenger` i
6767

6868
The following example implements the `Messenger` interface in Groovy:
6969

70-
[source,java,indent=0]
70+
[source,groovy,indent=0]
7171
[subs="verbatim,quotes"]
7272
----
7373
// from the file 'Messenger.groovy'
@@ -282,7 +282,7 @@ surrounded by quotation marks. The following listing shows the changes that you
282282
(the developer) should make to the `Messenger.groovy` source file when the
283283
execution of the program is paused:
284284

285-
[source,java,indent=0]
285+
[source,groovy,indent=0]
286286
[subs="verbatim,quotes"]
287287
----
288288
package org.springframework.scripting
@@ -371,7 +371,7 @@ constructors and properties 100% clear, the following mixture of code and config
371371
does not work:
372372

373373
.An approach that cannot work
374-
[source,java,indent=0]
374+
[source,groovy,indent=0]
375375
[subs="verbatim,quotes"]
376376
----
377377
// from the file 'Messenger.groovy'
@@ -480,9 +480,9 @@ Finally, the following small application exercises the preceding configuration:
480480
481481
public class Main {
482482
483-
public static void Main(String[] args) {
483+
public static void main(String[] args) {
484484
ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
485-
Calculator calc = (Calculator) ctx.getBean("calculator");
485+
Calculator calc = ctx.getBean("calculator", Calculator.class);
486486
System.out.println(calc.add(2, 8));
487487
}
488488
}
@@ -697,7 +697,7 @@ beans, you have to enable the "`refreshable beans`" functionality. See
697697
The following example shows an `org.springframework.web.servlet.mvc.Controller` implemented
698698
by using the Groovy dynamic language:
699699

700-
[source,java,indent=0]
700+
[source,groovy,indent=0]
701701
[subs="verbatim,quotes"]
702702
----
703703
// from the file '/WEB-INF/groovy/FortuneController.groovy'

0 commit comments

Comments
 (0)