Skip to content

Commit 162aedc

Browse files
committed
Polishing
1 parent f09c786 commit 162aedc

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectInstanceFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
2323
import org.springframework.core.Ordered;
2424
import org.springframework.core.annotation.OrderUtils;
25+
import org.springframework.util.Assert;
2526
import org.springframework.util.ClassUtils;
2627

2728
/**
@@ -69,6 +70,8 @@ public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name) {
6970
* @param type the type that should be introspected by AspectJ
7071
*/
7172
public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name, Class<?> type) {
73+
Assert.notNull(beanFactory, "BeanFactory must not be null");
74+
Assert.notNull(name, "Bean name must not be null");
7275
this.beanFactory = beanFactory;
7376
this.name = name;
7477
this.aspectMetadata = new AspectMetadata(type, name);

spring-context/src/main/java/org/springframework/scheduling/config/TriggerTask.java

Lines changed: 5 additions & 4 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-2016 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.
@@ -19,8 +19,8 @@
1919
import org.springframework.scheduling.Trigger;
2020

2121
/**
22-
* {@link Task} implementation defining a {@code Runnable} to be executed according to a
23-
* given {@link Trigger}.
22+
* {@link Task} implementation defining a {@code Runnable} to be executed
23+
* according to a given {@link Trigger}.
2424
*
2525
* @author Chris Beams
2626
* @since 3.2
@@ -45,6 +45,7 @@ public TriggerTask(Runnable runnable, Trigger trigger) {
4545

4646

4747
public Trigger getTrigger() {
48-
return trigger;
48+
return this.trigger;
4949
}
50+
5051
}

src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 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.
@@ -56,6 +56,7 @@ public void setUp() {
5656
Assume.group(TestGroup.PERFORMANCE);
5757
}
5858

59+
5960
@Test
6061
public void failsWhenJdkProxyAndScheduledMethodNotPresentOnInterface() {
6162
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
@@ -102,28 +103,36 @@ public void succeedsWhenJdkProxyAndScheduledMethodIsPresentOnInterface() throws
102103

103104
@Configuration
104105
@EnableTransactionManagement
105-
static class JdkProxyTxConfig { }
106+
static class JdkProxyTxConfig {
107+
}
108+
106109

107110
@Configuration
108111
@EnableTransactionManagement(proxyTargetClass=true)
109-
static class SubclassProxyTxConfig { }
112+
static class SubclassProxyTxConfig {
113+
}
114+
110115

111116
@Configuration
112117
static class RepoConfigA {
118+
113119
@Bean
114120
public MyRepository repository() {
115121
return new MyRepositoryImpl();
116122
}
117123
}
118124

125+
119126
@Configuration
120127
static class RepoConfigB {
128+
121129
@Bean
122130
public MyRepositoryWithScheduledMethod repository() {
123131
return new MyRepositoryWithScheduledMethodImpl();
124132
}
125133
}
126134

135+
127136
@Configuration
128137
@EnableScheduling
129138
static class Config {
@@ -140,15 +149,17 @@ public PlatformTransactionManager txManager() {
140149

141150
@Bean
142151
public PersistenceExceptionTranslator peTranslator() {
143-
PersistenceExceptionTranslator txlator = mock(PersistenceExceptionTranslator.class);
144-
return txlator;
152+
return mock(PersistenceExceptionTranslator.class);
145153
}
146154
}
147155

156+
148157
public interface MyRepository {
158+
149159
int getInvocationCount();
150160
}
151161

162+
152163
@Repository
153164
static class MyRepositoryImpl implements MyRepository {
154165

@@ -166,11 +177,15 @@ public int getInvocationCount() {
166177
}
167178
}
168179

180+
169181
public interface MyRepositoryWithScheduledMethod {
182+
170183
int getInvocationCount();
171-
public void scheduled();
184+
185+
void scheduled();
172186
}
173187

188+
174189
@Repository
175190
static class MyRepositoryWithScheduledMethodImpl implements MyRepositoryWithScheduledMethod {
176191

0 commit comments

Comments
 (0)