随笔分类 -  Groovy

Groovy
摘要:将jar包统一放置到一个目录里面,然后再Build.gradle里面添加引用。 阅读全文
posted @ 2020-05-12 14:51 duchaoqun 阅读(305) 评论(0) 推荐(0) 编辑
摘要:在 Grails 中打印日志 在 controller 和 service 中使用Log: Demo 在配置文件中配置相关,grails-app/conf/logback.groovy def index(Integer max) { log.info("Test logging.") params.max = Math.min(max ?: 10, 100) ... 阅读全文
posted @ 2020-05-12 14:41 duchaoqun 阅读(173) 评论(0) 推荐(0) 编辑
摘要:Grails SDK 下载SDK,配置环境变量GRAILS_HOME和PATH grails-4.0.3.zip Create APP grails create-app cn.duchaoqun.demo cd demo run-app Install Grails Spring Security Core Plugin 在build中添加引用 compile "org.grai... 阅读全文
posted @ 2020-05-12 14:19 duchaoqun 阅读(313) 评论(0) 推荐(0) 编辑
摘要:Summary 简单的级联关系 一个 Author 会有很多 Book。 Author 对 Book 是一对多的关系。 Book 对 Author 是多对一的关系。 Book belongs to Author。 在 Book 上设置 Foreign Key 对应 author_id,可以单独删除 book,但是存在书不能删除 author。 Demo class Author { ... 阅读全文
posted @ 2020-05-08 16:52 duchaoqun 阅读(151) 评论(0) 推荐(0) 编辑
摘要:Purpose 验证一个 String 类型的字段是否为 blank,其他类型设置无用。 Examples login blank: false Description 如果一个 String 类型字段不能是 空白,就设置成 false。 Error Code: className.property 阅读全文
posted @ 2020-04-30 10:23 duchaoqun 阅读(145) 评论(0) 推荐(0) 编辑
摘要:Purpose 允许一个 String 类型的字段被设置成 null,默认Grails不能为空。 class Domain { Integer id String url static constraints = { url nullable: true } } Description 当表单的输入框没有值的时候,Web 请求提交的是... 阅读全文
posted @ 2020-04-30 10:03 duchaoqun 阅读(218) 评论(0) 推荐(0) 编辑
摘要:问题 在IDEA中新打开这个microaut项目的时候,不能直接运行,只能打包运行,提示下面的错误: NoClassDefFoundError: io/micronaut/context/ApplicationContextBuilder 解决 阅读全文
posted @ 2020-04-09 10:15 duchaoqun 阅读(163) 评论(0) 推荐(0) 编辑
摘要:Summary 访问一个 Controller 的 Action,然后在这个 Action 中直接执行另外一个 Action,浏览器的 URL 也会显示为目标的地址。 官方文档:http://docs.grails.org/latest/ref/Controllers/redirect.html 参考文档:https://tosbourn.com/difference-between-redi... 阅读全文
posted @ 2019-11-11 12:28 duchaoqun 阅读(375) 评论(0) 推荐(0) 编辑
摘要:Summary 官方文档:http://docs.grails.org/latest/ref/Controllers/respond.html 为当前 respond 语句所在 Action 所对应的页面返回数据和对象。 可以响应另外一个 GSP 页面,但是 URL 还是当前的 Action,不会执行另外的 GSP 页面对应的 Action。 respond 必须返回一个“对象”,然后加上其他... 阅读全文
posted @ 2019-11-11 12:27 duchaoqun 阅读(238) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示