Created
March 17, 2016 06:45
-
-
Save orekyuu/65c7c061f7d34c01f7e9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package com.example | |
import org.aspectj.lang.JoinPoint | |
import org.aspectj.lang.ProceedingJoinPoint | |
import org.aspectj.lang.annotation.Around | |
import org.aspectj.lang.annotation.Aspect | |
import org.aspectj.lang.annotation.Before | |
import org.aspectj.lang.reflect.MethodSignature | |
import org.springframework.boot.SpringApplication | |
import org.springframework.boot.autoconfigure.SpringBootApplication | |
import org.springframework.stereotype.Component | |
import org.springframework.stereotype.Controller | |
import org.springframework.web.bind.annotation.RequestMapping | |
import org.springframework.web.bind.annotation.ResponseBody | |
@SpringBootApplication | |
@Controller | |
open class DemoApplication { | |
@ResponseBody | |
@RequestMapping("/") | |
open fun hello(): String { | |
println("/hello") | |
return "hello" | |
} | |
} | |
@Aspect | |
@Component | |
open class PrintlnAspect { | |
@Before("execution(public String com.example.DemoApplication.hello())") | |
open fun around(joinPoint: JoinPoint) { | |
println("before call: ${joinPoint.signature}") | |
} | |
} | |
fun main(args: Array<String>) { | |
SpringApplication.run(DemoApplication::class.java, *args) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment