Grails自动重新加载新的控制器操作 [英] Grails auto-reloading new controller actions
问题描述
- 创建了新的Grails 2.4.3项目
- 创建了
TestController
- set
grails.reload.enabled = true
BuildConfig.groovy - 使用
运行应用程序> grails -reloading run-app
我的控制器操作代码:
def index(){
rendertest
}
当我将字符串 test
to test2
- 我在控制台(在Eclipse中)看到:
..................
|编译1个源文件
重新加载页面后,我会看到 test2
- ok。
但是当我尝试添加新方法时:
def test3(){
rendertest3
}
我看到:
为什么? 为什么没有url?
示例 - 操作不存在:
有趣的是 - 当我创建一个全新的控制器时, index
新创建的控制器的作用...
编辑
过了一段时间,我决定采用spring-boot,而事实上 - 它也不起作用。我认为springloaded是这里的问题,因为它不会在 @Controller
中添加新的方法
我对 github repo 。
似乎最新的弹簧加载的SNAPSHOT 正常工作。
但它必须集成到Grails中 - 可能在下一个版本中很不幸:(
)I've
- created new Grails 2.4.3 project
- created
TestController
- set
grails.reload.enabled = true
inBuildConfig.groovy
- run application with
grails -reloading run-app
My controller action code:
def index() {
render "test"
}
When I change the string test
to test2
- I see in console (in Eclipse):
..................
|Compiling 1 source files
And after reloading page I see test2
- ok.
But when I try to add new method:
def test3() {
render "test3"
}
I see:
Why? Why there isn't even the url?
Example - action does't exist:
Interesting thing is - when I create a whole new controller the index
action of the newly created controller works...
EDIT
After a while I decided to go with spring-boot and as a matter of fact - there it's not working either. I think that springloaded is the issue here because it doesn't pick up added new method in @Controller
I've asked the same question on github repo.
It seems that latest spring-loaded SNAPSHOT is working fine.
But it must be integrated into Grails - maybe in the next release unfortunately :(
这篇关于Grails自动重新加载新的控制器操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!