I'm trying to convert a Java controller in my Spring Boot project to Groovy, and getting the strangest error when trying to compile and run
unexpected token: @ @ line 45, column 5
@RequestMapping(value = {"/v1/foo", "/foo"}, method = GET)
^
This is baffling to me. Annotations are annotations in Java or Groovy, right? what am I missing? Here's an abstraction of my code
// src/main/groovy/my/package/FooController.groovy, formerly .java
/// ... proper imports
@RestController
@EnableAutoConfiguration
public class FooController {
// ... @autowire services
@RequestMapping(value = {"/v1/foo", "/foo"}, method = GET)
public ResponseEntity get(@RequestHeader HttpHeaders headers) {
// do work return ResponseEntity
}
@RequestMapping(value = {"/v1/foo", "/foo"}, method = PUT)
public ResponseEntity put(@RequestHeader HttpHeaders headers, @ResponseBody @Valid final MyFoo myFoo) {
// do work return ResponseEntity
}
}