在我使用Kotlin构建的Spring应用程序中,我想对看起来像这样的数据类使用bean验证.
data class CustomerDto(
@field: NotBlank
val firstName: String,
@field: NotBlank
val lastName: String)
Run Code Online (Sandbox Code Playgroud)
在将具有空firstName的帖子发送到客户端点时,我想获得约束验证,但由于字段不允许空值,我没有得到验证,而是得到以下错误.
"status": 400,
"error": "Bad Request",
"message": "JSON parse error: Instantiation of [simple type, class pkg.CustomerDto] value failed for JSON property firstName due to missing (therefore NULL) value for creator parameter firstName which is a non-nullable type; nested exception is com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException: Instantiation of [simple type, class pkg.CustomerDto] value failed for JSON property firstName due to missing (therefore NULL) value for creator parameter firstName which is a …Run Code Online (Sandbox Code Playgroud) 我们的android应用程序变得相当大,我们希望为我们的应用程序使用功能测试来防止回归.我们正在寻找实现这一目标的方案.
我们使用地理位置,所以现在我们通过在DDMS中输入lat/long来测试应用程序.如果我们要测试它,应该可以以编程方式设置这些地理位置.
是否有一个框架,我们可以用来功能测试我们的Android应用程序,并将这些更新发送到我们的模拟器?
我的项目结构如下所示:
parent POM
|-- app-core
|-- app-model
|-- app-services
`-- app-web
Run Code Online (Sandbox Code Playgroud)
在我pom.xml的 app-web:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
<webDefaultXml>src/test/resources/webdefault.xml</webDefaultXml>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
热部署正常运行并且没有问题 mvn jetty:run
问题:app-core使用spring如何 在这个多模块层次结构中为Jetty maven插件配置这个JNDI,这应该可以在app-core模块中访问
更新:
像这样添加了pom.xml
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
<webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml>
<jettyConfig>src/main/resources/jetty.xml</jettyConfig>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我的jetty.xml看起来像这样:
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New id="icatDB" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/testDB</Arg>
<Arg>
<New class="net.sourceforge.jtds.jdbcx.JtdsDataSource">
<Set name="serverName">localhost</Set>
<Set name="databaseName">test</Set>
<Set name="user">sa</Set>
<Set name="password"></Set>
</New>
</Arg>
</New>
</Configure>
Run Code Online (Sandbox Code Playgroud)
之后当我运行mvn jetty时:运行我得到这个错误
Failure: Object is not of type class org.mortbay.jetty.webapp.WebAppContext
Run Code Online (Sandbox Code Playgroud)