Skip to content

Commit ee2022e

Browse files
committed
Polishing
1 parent a0ccd65 commit ee2022e

File tree

4 files changed

+44
-63
lines changed

4 files changed

+44
-63
lines changed

spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AspectJAsyncConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@
3232
* @since 3.1
3333
* @see EnableAsync
3434
* @see org.springframework.scheduling.annotation.AsyncConfigurationSelector
35+
* @see org.springframework.scheduling.annotation.ProxyAsyncConfiguration
3536
*/
3637
@Configuration
3738
public class AspectJAsyncConfiguration extends AbstractAsyncConfiguration {

spring-context/src/main/java/org/springframework/scheduling/annotation/AbstractAsyncConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void setImportMetadata(AnnotationMetadata importMetadata) {
5454
/**
5555
* Collect any {@link AsyncConfigurer} beans through autowiring.
5656
*/
57-
@Autowired(required = false)
57+
@Autowired(required=false)
5858
void setConfigurers(Collection<AsyncConfigurer> configurers) {
5959
if (CollectionUtils.isEmpty(configurers)) {
6060
return;
@@ -65,4 +65,5 @@ void setConfigurers(Collection<AsyncConfigurer> configurers) {
6565
AsyncConfigurer configurer = configurers.iterator().next();
6666
this.executor = configurer.getAsyncExecutor();
6767
}
68+
6869
}

spring-context/src/main/java/org/springframework/scheduling/annotation/ProxyAsyncConfiguration.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,21 +42,16 @@ public class ProxyAsyncConfiguration extends AbstractAsyncConfiguration {
4242
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
4343
public AsyncAnnotationBeanPostProcessor asyncAdvisor() {
4444
Assert.notNull(this.enableAsync, "@EnableAsync annotation metadata was not injected");
45-
4645
AsyncAnnotationBeanPostProcessor bpp = new AsyncAnnotationBeanPostProcessor();
47-
4846
Class<? extends Annotation> customAsyncAnnotation = enableAsync.getClass("annotation");
4947
if (customAsyncAnnotation != AnnotationUtils.getDefaultValue(EnableAsync.class, "annotation")) {
5048
bpp.setAsyncAnnotationType(customAsyncAnnotation);
5149
}
52-
5350
if (this.executor != null) {
5451
bpp.setExecutor(this.executor);
5552
}
56-
5753
bpp.setProxyTargetClass(this.enableAsync.getBoolean("proxyTargetClass"));
5854
bpp.setOrder(this.enableAsync.<Integer>getNumber("order"));
59-
6055
return bpp;
6156
}
6257

spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java

Lines changed: 39 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.Set;
2929

3030
import org.junit.Test;
31+
3132
import org.springframework.core.Ordered;
3233
import org.springframework.core.annotation.subpackage.NonPublicAnnotatedClass;
3334
import org.springframework.stereotype.Component;
@@ -37,6 +38,8 @@
3738
import static org.springframework.core.annotation.AnnotationUtils.*;
3839

3940
/**
41+
* Unit tests for {@link AnnotationUtils}.
42+
*
4043
* @author Rod Johnson
4144
* @author Juergen Hoeller
4245
* @author Sam Brannen
@@ -97,9 +100,9 @@ public void findMethodAnnotationOnBridgeMethod() throws Exception {
97100
// }
98101

99102
@Test
100-
public void findAnnotationPrefersInteracesOverLocalMetaAnnotations() {
103+
public void findAnnotationPrefersInterfacesOverLocalMetaAnnotations() {
101104
Component component = AnnotationUtils.findAnnotation(
102-
ClassWithLocalMetaAnnotationAndMetaAnnotatedInterface.class, Component.class);
105+
ClassWithLocalMetaAnnotationAndMetaAnnotatedInterface.class, Component.class);
103106

104107
// By inspecting ClassWithLocalMetaAnnotationAndMetaAnnotatedInterface, one
105108
// might expect that "meta2" should be found; however, with the current
@@ -144,8 +147,7 @@ public void findAnnotationDeclaringClassForTypesWithSingleCandidateType() {
144147
// inherited class-level annotation; note: @Transactional is inherited
145148
assertEquals(InheritedAnnotationInterface.class,
146149
findAnnotationDeclaringClassForTypes(transactionalCandidateList, InheritedAnnotationInterface.class));
147-
assertNull(findAnnotationDeclaringClassForTypes(transactionalCandidateList,
148-
SubInheritedAnnotationInterface.class));
150+
assertNull(findAnnotationDeclaringClassForTypes(transactionalCandidateList, SubInheritedAnnotationInterface.class));
149151
assertEquals(InheritedAnnotationClass.class,
150152
findAnnotationDeclaringClassForTypes(transactionalCandidateList, InheritedAnnotationClass.class));
151153
assertEquals(InheritedAnnotationClass.class,
@@ -301,8 +303,7 @@ public void findAnnotationFromInterfaceOnSuper() throws Exception {
301303
}
302304

303305
@Test
304-
public void findAnnotationFromInterfaceWhenSuperDoesNotImplementMethod()
305-
throws Exception {
306+
public void findAnnotationFromInterfaceWhenSuperDoesNotImplementMethod() throws Exception {
306307
Method method = SubOfAbstractImplementsInterfaceWithAnnotatedMethod.class.getMethod("foo");
307308
Order order = findAnnotation(method, Order.class);
308309
assertNotNull(order);
@@ -322,13 +323,13 @@ public void getRepeatableFromMethod() throws Exception {
322323
}
323324

324325

325-
@Component(value = "meta1")
326+
@Component(value="meta1")
326327
@Order
327328
@Retention(RetentionPolicy.RUNTIME)
328329
@interface Meta1 {
329330
}
330331

331-
@Component(value = "meta2")
332+
@Component(value="meta2")
332333
@Transactional
333334
@Retention(RetentionPolicy.RUNTIME)
334335
@interface Meta2 {
@@ -353,47 +354,44 @@ public static class Root implements AnnotatedInterface {
353354

354355
@Order(27)
355356
public void annotatedOnRoot() {
356-
357357
}
358358

359359
public void overrideToAnnotate() {
360-
361360
}
362361

363362
@Order(27)
364363
public void overrideWithoutNewAnnotation() {
365-
366364
}
367365

368366
public void notAnnotated() {
369-
370367
}
371368

372369
@Override
373370
public void fromInterfaceImplementedByRoot() {
374-
375371
}
376372
}
377373

378374
public static class Leaf extends Root {
379375

380376
@Order(25)
381377
public void annotatedOnLeaf() {
382-
383378
}
384379

385380
@Override
386381
@Order(1)
387382
public void overrideToAnnotate() {
388-
389383
}
390384

391385
@Override
392386
public void overrideWithoutNewAnnotation() {
393-
394387
}
395388
}
396389

390+
@Retention(RetentionPolicy.RUNTIME)
391+
@Inherited
392+
@interface Transactional {
393+
}
394+
397395
public static abstract class Foo<T> {
398396

399397
@Order(1)
@@ -405,7 +403,6 @@ public static class SimpleFoo extends Foo<String> {
405403
@Override
406404
@Transactional
407405
public void something(final String arg) {
408-
409406
}
410407
}
411408

@@ -474,58 +471,45 @@ public void foo() {
474471
}
475472
}
476473

477-
public abstract static class AbstractDoesNotImplementInterfaceWithAnnotatedMethod implements
478-
InterfaceWithAnnotatedMethod {
474+
public abstract static class AbstractDoesNotImplementInterfaceWithAnnotatedMethod
475+
implements InterfaceWithAnnotatedMethod {
479476
}
480477

481-
public static class SubOfAbstractImplementsInterfaceWithAnnotatedMethod extends
482-
AbstractDoesNotImplementInterfaceWithAnnotatedMethod {
478+
public static class SubOfAbstractImplementsInterfaceWithAnnotatedMethod
479+
extends AbstractDoesNotImplementInterfaceWithAnnotatedMethod {
483480

484481
@Override
485482
public void foo() {
486483
}
487484
}
488485

489-
public static interface InterfaceWithRepeated {
490-
491-
@MyRepeatable("a")
492-
@MyRepeatableContainer({ @MyRepeatable("b"), @MyRepeatable("c") })
493-
@MyRepeatableMeta
494-
void foo();
486+
@Retention(RetentionPolicy.RUNTIME)
487+
@Inherited
488+
@interface MyRepeatableContainer {
495489

490+
MyRepeatable[] value();
496491
}
497492

498-
}
499-
500-
501-
@Retention(RetentionPolicy.RUNTIME)
502-
@Inherited
503-
@interface Transactional {
504-
505-
}
506-
507-
508-
@Retention(RetentionPolicy.RUNTIME)
509-
@Inherited
510-
@interface MyRepeatableContainer {
511-
512-
MyRepeatable[] value();
513-
514-
}
515-
493+
@Retention(RetentionPolicy.RUNTIME)
494+
@Inherited
495+
@Repeatable(MyRepeatableContainer.class)
496+
@interface MyRepeatable {
516497

517-
@Retention(RetentionPolicy.RUNTIME)
518-
@Inherited
519-
@Repeatable(MyRepeatableContainer.class)
520-
@interface MyRepeatable {
498+
String value();
499+
}
521500

522-
String value();
501+
@Retention(RetentionPolicy.RUNTIME)
502+
@Inherited
503+
@MyRepeatable("meta")
504+
@interface MyRepeatableMeta {
505+
}
523506

524-
}
507+
public static interface InterfaceWithRepeated {
525508

509+
@MyRepeatable("a")
510+
@MyRepeatableContainer({ @MyRepeatable("b"), @MyRepeatable("c") })
511+
@MyRepeatableMeta
512+
void foo();
513+
}
526514

527-
@Retention(RetentionPolicy.RUNTIME)
528-
@Inherited
529-
@MyRepeatable("meta")
530-
@interface MyRepeatableMeta {
531515
}

0 commit comments

Comments
 (0)