问题
I have followed the Getting Started. First start of Application was Ok. Then I added a Controller as described (HelloController.java in src/main/java/helloworld. When I restart the server, I get the following error:
c:\dev\micronaut\helloworld>gradlew run
Task :compileJava FAILED Note: Creating bean classes for 1 type elements error: Unexpected error: Illegal name .$HelloControllerDefinition 1 error
I am under Windows 10 with jdk 1.8_171
回答1:
As Graeme Rocher mentioned, the class is missing it's package
. If you add the line I've added below, it should work.
package helloworld;
import io.micronaut.http.annotation.*;
@Controller("/hello")
public class HelloController {
@Get
public String index() {
return "Hello World";
}
}
来源:https://stackoverflow.com/questions/51057886/error-unexpected-error-illegal-name-hellocontrollerdefinition