You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用mn create-app生成Groovy服务应用得到Java类,是否会改为Groovy类?

Hey there, let's break this down for you:

Micronaut Groovy App: Java Application Class Default Behavior

First, to confirm what you're seeing: yes, when you run mn create-app my-groovy-app -features=groovy, the generated Application class is indeed Java-based. This is the current default behavior of the Micronaut CLI—even with the groovy feature enabled, the main entry point remains a Java class, while other scaffolded components (like controllers or services) will use Groovy.

As for whether this will change down the line: right now, there's no public roadmap indicating the Micronaut team plans to alter this default. That said, you don't have to stick with the Java class if you don't want to—switching to a Groovy-based entry point is straightforward:

  • Delete the auto-generated src/main/java/my/groovy/app/Application.java file
  • Create a new Application.groovy file under src/main/groovy/my/groovy/app/ with this code:
    package my.groovy.app
    
    import io.micronaut.runtime.Micronaut
    
    class Application {
        static void main(String[] args) {
            Micronaut.run(Application, args)
        }
    }
    

If you'd prefer the CLI to handle this out of the box, you could always submit a feature request to the Micronaut GitHub repository. The team often considers community feedback when prioritizing changes like this.

内容的提问来源于stack exchange,提问作者Dan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 10:09:42