【发布时间】:2019-02-05 02:47:27
【问题描述】:
尝试在 https://docs.micronaut.io/latest/guide/index.html#creatingServer上继续演示代码
步骤如下: src/main/java/example/helloworld/HelloController.java
出现错误:
> Task :compileJava FAILED
Note: Creating bean classes for 1 type elements
error: Unexpected error: Illegal name .$HelloControllerDefinition
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
1 actionable task: 1 executed
我知道还有一个与此相关的问题,但没有答案 error: Unexpected error: Illegal name .$HelloControllerDefinition
我该怎么办?
和 hellocontroller 完全按照文档所述
import io.micronaut.http.annotation.*;
@Controller("/hello")
public class HelloController {
@Get
public String index() {
return "Hello World";
}
}
【问题讨论】:
-
HelloController.java 文件是什么样的?
-
就像上面的演示一样。我已经编辑了我的问题并添加了代码
标签: micronaut