質問編集履歴

7

検証内容が誤っていたので修正

2018/10/17 08:40

投稿

koronatail
koronatail

スコア433

test CHANGED
File without changes
test CHANGED
@@ -140,6 +140,8 @@
140
140
 
141
141
  ```
142
142
 
143
+ **17:39** 上記のケースで呼び出されていたのは500エラー発生時のControllerでした。testLoginメソッドが呼ばれた場合には前後でまったく呼ばれていませんでした。
144
+
143
145
 
144
146
 
145
147
  ### バージョン情報

6

Beforeを追加した場合の呼び出し順を追記

2018/10/17 08:40

投稿

koronatail
koronatail

スコア433

test CHANGED
File without changes
test CHANGED
@@ -124,7 +124,21 @@
124
124
 
125
125
  WebSecurityConfigに@AspectJAutoProxyというのがついていなかったのでつけてみましたが特に何も変わらなかったので消しなおしました
126
126
 
127
- 17:07 @RequestMappingのついたtestLoginメソッドが、@Aroundのついたaroundメソッドよりも先に呼ばれていました。
127
+ **17:07** @RequestMappingのついたtestLoginメソッドが、@Aroundのついたaroundメソッドよりも先に呼ばれていました。
128
+
129
+ **17:11** 次のメソッドをAspectクラスに追加したばあいも、Controllerが先に呼び出されていました
130
+
131
+ ```java
132
+
133
+ @Before("@annotation(org.springframework.web.bind.annotation.RequestMapping)")
134
+
135
+ public void beforeController(JoinPoint jp) {
136
+
137
+ System.out.println("before !!");
138
+
139
+ }
140
+
141
+ ```
128
142
 
129
143
 
130
144
 

5

呼び出し順番について追記

2018/10/17 08:11

投稿

koronatail
koronatail

スコア433

test CHANGED
File without changes
test CHANGED
@@ -124,6 +124,8 @@
124
124
 
125
125
  WebSecurityConfigに@AspectJAutoProxyというのがついていなかったのでつけてみましたが特に何も変わらなかったので消しなおしました
126
126
 
127
+ 17:07 @RequestMappingのついたtestLoginメソッドが、@Aroundのついたaroundメソッドよりも先に呼ばれていました。
128
+
127
129
 
128
130
 
129
131
  ### バージョン情報

4

aspectjのバージョン追記

2018/10/17 08:09

投稿

koronatail
koronatail

スコア433

test CHANGED
File without changes
test CHANGED
@@ -132,7 +132,9 @@
132
132
 
133
133
  Spring Boot 1.3.6
134
134
 
135
-
135
+ Aspectj 1.8.9
136
+
137
+ https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop/1.3.6.RELEASE
136
138
 
137
139
  ### POM
138
140
 

3

pom.xmlを追加

2018/10/17 08:04

投稿

koronatail
koronatail

スコア433

test CHANGED
File without changes
test CHANGED
@@ -131,3 +131,251 @@
131
131
  Spring MVC 4.2.7
132
132
 
133
133
  Spring Boot 1.3.6
134
+
135
+
136
+
137
+ ### POM
138
+
139
+ ```xml
140
+
141
+ <?xml version="1.0" encoding="UTF-8"?>
142
+
143
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
144
+
145
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
146
+
147
+ <modelVersion>4.0.0</modelVersion>
148
+
149
+
150
+
151
+ <groupId>testtest</groupId>
152
+
153
+ <artifactId>testtest</artifactId>
154
+
155
+ <name>testtest</name>
156
+
157
+ <url>http://maven.apache.org</url>
158
+
159
+ <description>project for Spring Boot</description>
160
+
161
+
162
+
163
+ <parent>
164
+
165
+ <groupId>org.springframework.boot</groupId>
166
+
167
+ <artifactId>spring-boot-starter-parent</artifactId>
168
+
169
+ <version>1.3.6.RELEASE</version>
170
+
171
+ </parent>
172
+
173
+
174
+
175
+ <dependencies>
176
+
177
+ <dependency>
178
+
179
+ <groupId>org.springframework.boot</groupId>
180
+
181
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
182
+
183
+ </dependency>
184
+
185
+ <dependency>
186
+
187
+ <groupId>org.springframework.boot</groupId>
188
+
189
+ <artifactId>spring-boot-starter-jdbc</artifactId>
190
+
191
+ </dependency>
192
+
193
+ <dependency>
194
+
195
+ <groupId>org.springframework.boot</groupId>
196
+
197
+ <artifactId>spring-boot-starter-tomcat</artifactId>
198
+
199
+ <scope>provided</scope>
200
+
201
+ </dependency>
202
+
203
+ <dependency>
204
+
205
+ <groupId>org.springframework.boot</groupId>
206
+
207
+ <artifactId>spring-boot-starter-thymeleaf</artifactId>
208
+
209
+ </dependency>
210
+
211
+ <dependency>
212
+
213
+ <groupId>org.springframework.boot</groupId>
214
+
215
+ <artifactId>spring-boot-starter-web</artifactId>
216
+
217
+ </dependency>
218
+
219
+
220
+
221
+ <dependency>
222
+
223
+ <groupId>org.springframework.boot</groupId>
224
+
225
+ <artifactId>spring-boot-starter-test</artifactId>
226
+
227
+ <scope>test</scope>
228
+
229
+ </dependency>
230
+
231
+ <dependency>
232
+
233
+ <groupId>net.sourceforge.nekohtml</groupId>
234
+
235
+ <artifactId>nekohtml</artifactId>
236
+
237
+ <version>1.9.21</version><!--$NO-MVN-MAN-VER$-->
238
+
239
+ </dependency>
240
+
241
+
242
+
243
+ <dependency>
244
+
245
+ <groupId>org.thymeleaf.extras</groupId>
246
+
247
+ <artifactId>thymeleaf-extras-java8time</artifactId>
248
+
249
+ <version>2.1.0.RELEASE</version>
250
+
251
+ </dependency>
252
+
253
+
254
+
255
+ <!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
256
+
257
+ <dependency>
258
+
259
+ <groupId>org.apache.commons</groupId>
260
+
261
+ <artifactId>commons-lang3</artifactId>
262
+
263
+ <version>3.4</version>
264
+
265
+ </dependency>
266
+
267
+
268
+
269
+ <!-- spring security -->
270
+
271
+ <dependency>
272
+
273
+ <groupId>org.springframework.boot</groupId>
274
+
275
+ <artifactId>spring-boot-starter-security</artifactId>
276
+
277
+ </dependency>
278
+
279
+ <dependency>
280
+
281
+ <groupId>org.thymeleaf.extras</groupId>
282
+
283
+ <artifactId>thymeleaf-extras-springsecurity4</artifactId>
284
+
285
+ </dependency>
286
+
287
+ <!-- spring security -->
288
+
289
+ <dependency>
290
+
291
+ <groupId>org.springframework.boot</groupId>
292
+
293
+ <artifactId>spring-boot-configuration-processor</artifactId>
294
+
295
+ <optional>true</optional>
296
+
297
+ </dependency>
298
+
299
+ <!-- -->
300
+
301
+
302
+
303
+
304
+
305
+ <dependency>
306
+
307
+ <groupId>com.microsoft.sqlserver</groupId>
308
+
309
+ <artifactId>mssql-jdbc</artifactId>
310
+
311
+ <version>6.2.1.jre8</version>
312
+
313
+ </dependency>
314
+
315
+
316
+
317
+
318
+
319
+ </dependencies>
320
+
321
+
322
+
323
+ <repositories>
324
+
325
+ <repository>
326
+
327
+ <id>forgerock</id>
328
+
329
+ <url>http://maven.forgerock.org/repo/releases</url>
330
+
331
+ </repository>
332
+
333
+ </repositories>
334
+
335
+
336
+
337
+ <properties>
338
+
339
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
340
+
341
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
342
+
343
+ <java.version>1.8</java.version>
344
+
345
+ <openam.version>10.0.0</openam.version>
346
+
347
+ <!-- property name = "hibernate.show_sql" value = "true" /-->
348
+
349
+ </properties>
350
+
351
+
352
+
353
+ <build>
354
+
355
+ <plugins>
356
+
357
+ <plugin>
358
+
359
+ <groupId>org.springframework.boot</groupId>
360
+
361
+ <artifactId>spring-boot-maven-plugin</artifactId>
362
+
363
+ <configuration>
364
+
365
+ <failOnMissingWebXml>false</failOnMissingWebXml>
366
+
367
+ </configuration>
368
+
369
+ </plugin>
370
+
371
+ </plugins>
372
+
373
+ </build>
374
+
375
+
376
+
377
+ <packaging>war</packaging>
378
+
379
+ </project>
380
+
381
+ ```

2

バージョン記入

2018/10/17 08:00

投稿

koronatail
koronatail

スコア433

test CHANGED
File without changes
test CHANGED
@@ -123,3 +123,11 @@
123
123
  追記
124
124
 
125
125
  WebSecurityConfigに@AspectJAutoProxyというのがついていなかったのでつけてみましたが特に何も変わらなかったので消しなおしました
126
+
127
+
128
+
129
+ ### バージョン情報
130
+
131
+ Spring MVC 4.2.7
132
+
133
+ Spring Boot 1.3.6

1

@AspectJAutoProxyを試してみたがだめだった

2018/10/17 07:56

投稿

koronatail
koronatail

スコア433

test CHANGED
File without changes
test CHANGED
@@ -115,3 +115,11 @@
115
115
  ControllerLoggerAspect内のメソッドが呼び出されませんでした。
116
116
 
117
117
  何か思い当たることがあれば回答いただければと思います。
118
+
119
+
120
+
121
+
122
+
123
+ 追記
124
+
125
+ WebSecurityConfigに@AspectJAutoProxyというのがついていなかったのでつけてみましたが特に何も変わらなかったので消しなおしました