问题标签 [grails-2.0]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
grails - 我无法使用 Geb 和 spock 运行简单的 Grails 功能测试
我正在寻求帮助,因为我不知道如何处理这个错误......所以首先让我展示运行我非常简单的测试时得到的堆栈跟踪,奇怪的是我的测试似乎没有被执行……?我正在使用 Grails 2.0
这里是 groovy 文件:
SecondaryTest.groovy:
SignInPage.groovy :
谢谢
grails - grails 2.0 - formatDate 使用 fieldValue,这是 Grails 2.0 中的错误吗?
在我的 Grails 2.0 中,以下 GSP 代码有效:
但是代码
导致以下错误:
Stacktrace 如下:消息:未知类:org.codehaus.groovy.grails.web.util.StreamCharBuffer
我尝试了单引号和双引号的不同组合,但得到了相同的错误。这段代码在 Grails 1.3.7 中工作,所以?在那里,我实际上dateCreated
在 date="..." 和 date="..." 上都使用了双引号。
如果您有时间,请您在您的一个域对象中测试一个 dateCreated 字段,看看您是否得到相同的结果。也许我还有其他一些我不知道的 Grails 2.0 更新问题?
万一这很重要,我会这样迭代merchantTrans
对象:
谢谢,雷
grails - Grails 2.0 中的 dateCreated、lastUpdated 字段
我有一个使用 Grails 1.3.7 的应用程序,我刚刚迁移到 Grails 2.0。该应用程序利用自动dateCreated
和lastUpdated
字段来管理与对象的创建和修改相关的时间戳。升级后,我收到以下错误:
在我的域类中注释掉上述字段会使问题消失。
Grails 2.0 中是否已弃用anddateCreated
字段?lastUpdated
如果是这样,这是否意味着我必须编写代码来手动处理此功能,或者代码是否已移至某种插件,例如审计跟踪插件?
grails - Grails 2.0 模式导出
当我运行时,我的 Grails 2.0 应用程序似乎正在尝试连接到我的生产数据库:
我只想要生产数据库的 DDL。Grails 1.3.7 没有发生这种情况。这在版本之间有变化吗?
grails - grails 2.0 包含资源的简单方法?
在从 Grails 1.3.7 到 Grails 2.0 的迁移过程中,我一直在与各种资源包含问题作斗争,可能一开始可能不了解一些事情。
首先,做什么
做?(这是在 Grails 1.3.7 中提供的默认 main.gsp 中)。
其次,为了在我的应用程序中包含 jquery,我可以这样做吗
在我的主站点网格页面的顶部
和“完成它”,使用
之后的第二次
谢谢
unit-testing - 使用 @TestFor 和 @Mixin 的 Grails 2.0 单元测试
我通常在测试代码中使用 Mixins 来跨测试共享实用程序方法。我有一个我写的测试,它有一个@TestFor
和@Mixin
。我看到的行为是,当我有@TestFor
注释时,测试看不到我的@Mixin
代码,并在执行时给了我一个 MissingMethodException 。当我删除它时,@TestFor
它工作正常。下面是我正在尝试做的一个简化示例。
所以我的问题是做@Mixin
和@TestFor
注释不能一起工作?还是我在这里做错了什么?
grails - grails - 在 Heroku 上测试 spring-security-core 安全通道的简单应用程序
因为在这个问题中设置端口并没有解决重定向循环问题,所以我创建了一个简单的测试应用程序(grails 2.0,最新的 spring-security-core 1.2.7.1),所以重定向循环问题很容易重现/希望解决:步骤如下:
1-创建了名为 test 的新应用程序,并创建了一个名为 simple 的控制器(也在测试包中),即:
2- grails 是否安装了 spring-security-core 以及grails s2-quickstart 测试用户角色
3- 在 Config.groovy 中,添加以下几行,然后执行 run-app -https在我的开发机器上进行测试:
结果:全部结帐,可以输入网址../simple/start,然后输入../simple/middle进入SSL/https模式,随意。
4- 在 Config.groovy 中,然后我将端口配置为在 Heroku 上运行(估计,没有找到文档/参考):
5- 完成git init步骤 后,git add 。,git commit -m "initial commit"和heroku create --stack cedar,我去了 Heroku 并将 PiggyBack SSL 添加到那里新创建的应用程序中。然后我做了一个git push heroku master来部署。
结果:得到常见的“IllegalStateException,未找到线程绑定请求”,此处和此处描述的问题。
6- 因此,在 BuildConfig.groovy 中,我对 plugins {} 部分进行了以下 2 处更改:
结果: IllegalStateException 消失了,我可以访问简单的控制器(和登录控制器)。我可以在这些网址前加上 https,一切都很好。但是,如果我输入 ../simple/middle URL,我会得到重定向循环(类似于此处的跟踪)。
7-出于好奇,我在步骤 6 中注释掉了一半的更改,即//compile: "webxml:1.4.1":
结果:得到相同的 IllegalStateException
8-因为我不确定 Heroku 和云支持插件是如何影响上述基本步骤的,所以我一直等到这一步才添加它们。然后我做了 grails install-plugin cloud-support 和grails install-plugin heroku,并更新了 BuildConfig.groovy 所以它现在看起来像:
然后清理并更新了 git 存储库并推送到 heroku。
结果:相同的 IllegalStateException(注意 webxml 依赖项已被注释掉)。
9-然后我取消注释compile ":webxml:1.4.1",并再次推送到heroku:
结果:与第 3 步完全相同。即除了 ../simple/middle 之外,所有 URL 都有效,包括添加 https 前缀。转到 ../simple/middle URL 会导致重定向循环问题。
你能建议如何解决这个问题吗?如果有什么东西让我尝试(即不确定的解决方案),请更新评论部分,我会回复结果。非常感谢。
-------------------------------------------------- --------------------------------------
使用新的 spring-security 1.2.7.2 进行更新。
我的 BuildConfig.groovy 现在是:
即使使用 MySql,在部署到 Heroku 时也会出现 PostGres 依赖错误。因此,我删除了 Heroku 上的所有应用程序并清理了我的 git 存储库,并开始使用全新的部署/全新应用程序。
仍然得到这个 PostGres 依赖错误(下)。注意:以前在 MySql 工作时收到“未找到事务管理器 - 如果您的 webapp 需要一个,请配置一个”警告。唔。
grails - Grails 2.0 和 Flot 插件...无法正常工作
谁能指出我为什么以下不会输出任何图表。我安装了 flot 插件并使用 Grails 2.0,所以 jquery 是默认的...
jquery - 在 Grails 2.0 中使用 AJAX 提交表单的问题
在我的 GSP 页面中,我有这个表格:
在同一页面中,我有这个 div :
当我单击按钮时,应用程序确实会addPostAjax
在我的控制器中触发操作,但问题是我不知道如何发回user.posts
集合以填充我的allPosts
div。
有没有人有想法请。谢谢。
testing - How to unit or integration test use of injected messageSource for i18n in Grails 2.0 service
I make use of a message bundle in one of my services in a Grails 2.0 project for internationalized text. The use case is an email subject that is sent via the mail plugin in an asynchronous way, so it really doesn't make sense to have this in a controller or TagLib (given the usual argument of not accessing your text or views in a service). This code works fine in my running Grails app, but I'm not sure how to test it.
I tried a PluginAwareResourceBundleMessageSource
in my defineBeans as that is what my running application injects, but it led to nullpointers as it appears it needs a bunch of setup around plugin managers and such that my test environment is not giving (even integration).
I then tried a ReloadableResourceBundleMessageSource
as it was pure Spring, but it can't seem to see my .properties files, and fails with a No message found under code 'my.email.subject' for locale 'en'.
I feel like I'm going down a wormhole a bit as accessing Grails i18n in a service is not documented in the grails docs, so if there is a preferred way to do this, let me know.
Note my .properties file is in the standard grails-app/i18n
location.
The test
Service: