Proposal: class as a use-site annotation target fo...
# language-proposals
e
Proposal: class as a use-site annotation target for top level functions. Example syntax and very basic potential use case, using Spring Boot:
Copy code
@class:Controller
@GetMapping("/test")
fun singleFunController() = "viewname"
At the moment all top level functions in a file compile to the same class, so any with a class annotation would have to compile to its own class, presumably with a name based on the function name,
SingleFunControllerKt
or something. Probably a little limited in use, but it would be neat.
👍 1
f
Can static functions be used in Spring controllers? 🤔 That said, they're already working on a DSL in Spring that makes all these annotations obsolete.