Grails 3.0.1 - 如何在application.yml中配置grails.gorm.default.constraints [英] Grails 3.0.1 - how to configure grails.gorm.default.constraints in application.yml

查看:89
本文介绍了Grails 3.0.1 - 如何在application.yml中配置grails.gorm.default.constraints的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我采用了旧配置:

  grails.gorm.default.constraints = {
'*'( nullable:true,blank:true)
}

...并放入 application.groovy



幸运的是,它按预期工作。

如何在 application.yml 中定义它?我试过:

  grails:
gorm:
默认值:
约束:
'*'(可为空,true,空白:真)

但是这会给出错误。 / p>

解决方案

application.groovy 是做这件事的地方。 Groovy中的 .yml 配置文件中的代码无效且不受支持。

I took the old configuration:

grails.gorm.default.constraints = {
    '*' (nullable: true, blank: true)
}

... and put it in the application.groovy.

Luckily it worked as expected.

How would one define this in application.yml? I tried:

grails:
    gorm:
        default:
            constraints:
                '*' (nullable: true, blank: true)

but this gives errors on start.

解决方案

application.groovy is the place to do that. Groovy code in a .yml config file is invalid and not supported.

这篇关于Grails 3.0.1 - 如何在application.yml中配置grails.gorm.default.constraints的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆