| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,6 +22,7 @@ | |||
| 22 | 22 | import org.springframework.beans.factory.config.ConfigurableBeanFactory; | |
| 23 | 23 | import org.springframework.core.Ordered; | |
| 24 | 24 | import org.springframework.core.annotation.OrderUtils; | |
| 25 | + import org.springframework.util.Assert; | ||
| 25 | 26 | import org.springframework.util.ClassUtils; | |
| 26 | 27 | ||
| 27 | 28 | /** | |
@@ -69,6 +70,8 @@ public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name) { | |||
| 69 | 70 | * @param type the type that should be introspected by AspectJ | |
| 70 | 71 | */ | |
| 71 | 72 | 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"); | ||
| 72 | 75 | this.beanFactory = beanFactory; | |
| 73 | 76 | this.name = name; | |
| 74 | 77 | this.aspectMetadata = new AspectMetadata(type, name); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | /* | |
| 2 | - * Copyright 2002-2012 the original author or authors. | ||
| 2 | + * Copyright 2002-2016 the original author or authors. | ||
| 3 | 3 | * | |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | 5 | * you may not use this file except in compliance with the License. | |
@@ -19,8 +19,8 @@ | |||
| 19 | 19 | import org.springframework.scheduling.Trigger; | |
| 20 | 20 | ||
| 21 | 21 | /** | |
| 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}. | ||
| 24 | 24 | * | |
| 25 | 25 | * @author Chris Beams | |
| 26 | 26 | * @since 3.2 | |
@@ -45,6 +45,7 @@ public TriggerTask(Runnable runnable, Trigger trigger) { | |||
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | 47 | public Trigger getTrigger() { | |
| 48 | - return trigger; | ||
| 48 | + return this.trigger; | ||
| 49 | 49 | } | |
| 50 | + | ||
| 50 | 51 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | /* | |
| 2 | - * Copyright 2002-2015 the original author or authors. | ||
| 2 | + * Copyright 2002-2016 the original author or authors. | ||
| 3 | 3 | * | |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | 5 | * you may not use this file except in compliance with the License. | |
@@ -56,6 +56,7 @@ public void setUp() { | |||
| 56 | 56 | Assume.group(TestGroup.PERFORMANCE); | |
| 57 | 57 | } | |
| 58 | 58 | ||
| 59 | + | ||
| 59 | 60 | @Test | |
| 60 | 61 | public void failsWhenJdkProxyAndScheduledMethodNotPresentOnInterface() { | |
| 61 | 62 | AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); | |
@@ -102,28 +103,36 @@ public void succeedsWhenJdkProxyAndScheduledMethodIsPresentOnInterface() throws | |||
| 102 | 103 | ||
| 103 | 104 | @Configuration | |
| 104 | 105 | @EnableTransactionManagement | |
| 105 | - static class JdkProxyTxConfig { } | ||
| 106 | + static class JdkProxyTxConfig { | ||
| 107 | + } | ||
| 108 | + | ||
| 106 | 109 | ||
| 107 | 110 | @Configuration | |
| 108 | 111 | @EnableTransactionManagement(proxyTargetClass=true) | |
| 109 | - static class SubclassProxyTxConfig { } | ||
| 112 | + static class SubclassProxyTxConfig { | ||
| 113 | + } | ||
| 114 | + | ||
| 110 | 115 | ||
| 111 | 116 | @Configuration | |
| 112 | 117 | static class RepoConfigA { | |
| 118 | + | ||
| 113 | 119 | @Bean | |
| 114 | 120 | public MyRepository repository() { | |
| 115 | 121 | return new MyRepositoryImpl(); | |
| 116 | 122 | } | |
| 117 | 123 | } | |
| 118 | 124 | ||
| 125 | + | ||
| 119 | 126 | @Configuration | |
| 120 | 127 | static class RepoConfigB { | |
| 128 | + | ||
| 121 | 129 | @Bean | |
| 122 | 130 | public MyRepositoryWithScheduledMethod repository() { | |
| 123 | 131 | return new MyRepositoryWithScheduledMethodImpl(); | |
| 124 | 132 | } | |
| 125 | 133 | } | |
| 126 | 134 | ||
| 135 | + | ||
| 127 | 136 | @Configuration | |
| 128 | 137 | @EnableScheduling | |
| 129 | 138 | static class Config { | |
@@ -140,15 +149,17 @@ public PlatformTransactionManager txManager() { | |||
| 140 | 149 | ||
| 141 | 150 | @Bean | |
| 142 | 151 | public PersistenceExceptionTranslator peTranslator() { | |
| 143 | - PersistenceExceptionTranslator txlator = mock(PersistenceExceptionTranslator.class); | ||
| 144 | - return txlator; | ||
| 152 | + return mock(PersistenceExceptionTranslator.class); | ||
| 145 | 153 | } | |
| 146 | 154 | } | |
| 147 | 155 | ||
| 156 | + | ||
| 148 | 157 | public interface MyRepository { | |
| 158 | + | ||
| 149 | 159 | int getInvocationCount(); | |
| 150 | 160 | } | |
| 151 | 161 | ||
| 162 | + | ||
| 152 | 163 | @Repository | |
| 153 | 164 | static class MyRepositoryImpl implements MyRepository { | |
| 154 | 165 | ||
@@ -166,11 +177,15 @@ public int getInvocationCount() { | |||
| 166 | 177 | } | |
| 167 | 178 | } | |
| 168 | 179 | ||
| 180 | + | ||
| 169 | 181 | public interface MyRepositoryWithScheduledMethod { | |
| 182 | + | ||
| 170 | 183 | int getInvocationCount(); | |
| 171 | - public void scheduled(); | ||
| 184 | + | ||
| 185 | + void scheduled(); | ||
| 172 | 186 | } | |
| 173 | 187 | ||
| 188 | + | ||
| 174 | 189 | @Repository | |
| 175 | 190 | static class MyRepositoryWithScheduledMethodImpl implements MyRepositoryWithScheduledMethod { | |
| 176 | 191 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments