-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from yinjihuan/encrypt1.1
AOP注解扫描失效问题解决
- Loading branch information
Showing
3 changed files
with
67 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...example/src/main/java/com/cxytiandi/encrypt_springboot_example/aspect/ApiLimitAspect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.cxytiandi.encrypt_springboot_example.aspect; | ||
|
||
import org.aspectj.lang.ProceedingJoinPoint; | ||
import org.aspectj.lang.annotation.Around; | ||
import org.aspectj.lang.annotation.Aspect; | ||
import org.springframework.core.Ordered; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* 使用切面模拟注解扫描不到问题 | ||
* @author yinjihuan | ||
* | ||
*/ | ||
//@Component | ||
@Aspect | ||
@Order(value = Ordered.HIGHEST_PRECEDENCE) | ||
public class ApiLimitAspect { | ||
|
||
@Around("execution(* com.cxytiandi.encrypt_springboot_example.controller.*.*(..))") | ||
public Object around(ProceedingJoinPoint joinPoint) { | ||
try { | ||
return joinPoint.proceed(); | ||
} catch (Throwable e) { | ||
e.printStackTrace(); | ||
} | ||
return null; | ||
} | ||
} |