I have a rest controller with @GetMapping annotation for mapping HTTP requests onto specific handler methods:
@RestController
class Handler(){
@GetMapping(path = ["method"])
fun handlerMethod(){
//...
}
}
Also I have email service where I need to send some email with link to my endpoint (in that case http://host/method)
@Service
class EmailService(val config: Config){
fun sendEmail(){
// send "config.baseUrl/${getMethodPath()}"
}
fun getMethodPath(){
//todo
}
}
Here I get base url from configuration (http://host). Is there any way to get path attribute in EmailService from Handler's @GetMapping for build link to my service?