小编Rat*_*Rat的帖子

谷歌测试 - 课前

我正在运行谷歌测试.

我需要像课前一样的东西.我有SetUp()TearDown()函数,但它们在每次测试之前和之后运行.现在我需要一些全局的东西 - 比如ctor,在类加载时应该只运行一次.

c++ unit-testing googletest

11
推荐指数
2
解决办法
7895
查看次数

从spring MVC控制器返回xml文件

我已经尝试了很多从控制器函数返回一个文件.

这是我的功能:

@RequestMapping(value = "/files", method = RequestMethod.GET)
@ResponseBody public FileSystemResource getFile() {
     return new FileSystemResource(new File("try.txt")); 
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息:

无法编写JSON:
找不到类java.io.FileDescriptor的序列化程序,也没有发现创建BeanSerializer的属性
(为了避免异常,禁用SerializationFeature.FAIL_ON_EMPTY_BEANS))
(通过引用链:
org.springframework.core.io.FileSystemResource [\"的OutputStream\"] - > java.io.FileOutputStream中[\" FD \"]);
嵌套异常是com.fasterxml.jackson.databind.JsonMappingException:没有为类java.io.FileDescriptor找到序列化器,也没有发现创建BeanSerializer的属性
(为了避免异常,禁用SerializationFeature.FAIL_ON_EMPTY_BEANS))
(通过引用链:org.springframework. core.io.FileSystemResource [\ "的OutputStream \"] - > java.io.FileOutputStream中[\ "FD \"])

有谁知道如何解决它?

而且,我应该如何从客户端发送(JavaScript,jQuery)?

java xml spring file spring-mvc

6
推荐指数
1
解决办法
5995
查看次数

标签 统计

c++ ×1

file ×1

googletest ×1

java ×1

spring ×1

spring-mvc ×1

unit-testing ×1

xml ×1