File tree Expand file tree Collapse file tree 4 files changed +44
-2
lines changed
spring-boot-data-aggregator-example
java/io/github/lvyahui8/spring/example Expand file tree Collapse file tree 4 files changed +44
-2
lines changed Original file line number Diff line number Diff line change 27
27
<groupId >org.springframework.boot</groupId >
28
28
<artifactId >spring-boot-starter</artifactId >
29
29
</dependency >
30
+ <dependency >
31
+ <groupId >org.springframework.boot</groupId >
32
+ <artifactId >spring-boot-starter-aop</artifactId >
33
+ </dependency >
30
34
<dependency >
31
35
<groupId >org.springframework.boot</groupId >
32
36
<artifactId >spring-boot-starter-test</artifactId >
Original file line number Diff line number Diff line change 17
17
* @since 2019/6/1 0:13
18
18
*/
19
19
20
- @ SpringBootApplication
20
+ @ SpringBootApplication ( scanBasePackages = "io.github.lvyahui8.spring.example" )
21
21
@ Slf4j
22
22
public class ExampleApplication {
23
23
Original file line number Diff line number Diff line change
1
+ package io .github .lvyahui8 .spring .example .aspect ;
2
+
3
+ import lombok .extern .slf4j .Slf4j ;
4
+ import org .aspectj .lang .ProceedingJoinPoint ;
5
+ import org .aspectj .lang .annotation .Around ;
6
+ import org .aspectj .lang .annotation .Aspect ;
7
+ import org .aspectj .lang .annotation .Pointcut ;
8
+ import org .springframework .stereotype .Component ;
9
+
10
+ /**
11
+ * @author lvyahui (lvyahui8@gmail.com,lvyahui8@126.com)
12
+ * @since 2019/7/7 23:17
13
+ */
14
+ @ Aspect
15
+ @ Component
16
+ @ Slf4j
17
+ public class AggregateQueryLoggingAspect {
18
+
19
+ public AggregateQueryLoggingAspect () {
20
+ log .info ("init aspect bean" );
21
+ }
22
+
23
+ @ Pointcut ("execution(* io.github.lvyahui8.spring.aggregate.service.impl.DataBeanAggregateQueryServiceImpl.*(..))" )
24
+ public void aggregateQuery () {}
25
+
26
+ @ Around ("execution(* io.github.lvyahui8.spring.aggregate.service.impl.DataBeanAggregateQueryServiceImpl.*(..))" )
27
+ public Object doLogging (ProceedingJoinPoint joinPoint ) throws Throwable {
28
+ Object retVal ;
29
+ try {
30
+ retVal = joinPoint .proceed ();
31
+ } finally {
32
+ log .info ("x" );
33
+ }
34
+ return retVal ;
35
+ }
36
+ }
Original file line number Diff line number Diff line change 1
1
spring.main.banner-mode =off
2
2
io.github.lvyahui8.spring.base-packages =io.github.lvyahui8.spring.example
3
3
io.github.lvyahui8.spring.ignore-exception =false
4
- io.github.lvyahui8.spring.enable-logging =false
4
+ io.github.lvyahui8.spring.enable-logging =false
5
+ spring.aop.auto =true
6
+ spring.aop.proxy-target-class =true
You can’t perform that action at this time.
0 commit comments