- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在使用 Maven 的 Failsafe 插件为我的 Spring Boot 应用程序运行集成测试。当我创建一个像这样的简单测试时:
@RunWith (SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(App.class)
public class MyTestIT {
@Test
public void test() {
assertTrue (true);
}
}
然后运行 mvn verify
我在 Spring 应用程序启动之前(例如,甚至在 Spring Boot 横幅之前)看到以下日志条目:
Running org.....MyTestIT
2016-04-14 13:25:01.166 INFO ???? --- [ main]
or.sp.te.co.su.AbstractContextLoader :
Could not detect default resource locations for test class
[org....MyTestIT]: no resource found for suffixes
{-context.xml, Context.groovy}.
2016-04-14 13:25:01.175 INFO ???? --- [ main]
or.sp.te.co.su.DefaultTestContextBootstrapper :
Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
2016-04-14 13:25:01.185 INFO ???? --- [ main]
or.sp.te.co.su.DefaultTestContextBootstrapper : Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@57c758ac, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@a9cd3b1, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@13e39c73, org.springframework.test.context.support.DirtiesContextTestExecutionListener@64cd705f, org.springframework.test.context.transaction.TransactionalTestExecutionListener@9225652, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@654f0d9c]
后面是 Spring Boot 横幅。测试然后运行,没有任何错误。虽然这些消息是用 INFO 日志级别打印的,并且测试运行正常,但我想一切都很好,但我仍然觉得这些消息很烦人。那么我的配置有问题吗? 我应该担心这些消息吗?
即使没有任何问题,我仍然想了解那里发生了什么以及消息的含义。
我的 maven-failsafe-plugin
只是使用默认配置,而我的 App.java
只是一个用 @SpringBootApplication
注释的简单类.
更新 1:
这是我的测试插件的配置:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Ignore any tests that are marked by the @IntegrationTest annotation of Spring Boot -->
<excludedGroups>org.springframework.boot.test.IntegrationTest</excludedGroups>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
我还配置了一个 spring-boot-starter-test
依赖项,我正在使用 spring-boot-devtools
。除此之外,其他一切都与测试无关。
它自己的项目非常标准,使用 hibernate 和 mysql 以及 web-mvc 作为 rest 端点。我在类(class)通行证上有两个用于 spring security 的配置类。
在 main/resources
文件夹中,我有一个 application.properties
文件和一个 log4j2.xml。没有 test/resources
文件夹,但是当我只是将 main/resources 文件夹复制到 test/resources
时,上面的日志消息仍然出现。
更新 2:我刚刚创建了一个小的示例应用程序来尝试重现该问题,并且当我将 log4j2.xml
文件放入资源文件夹时,似乎提到的日志输出开始出现。我尝试将它放在 src/main
或 src/test
或两者中,效果相同。
最佳答案
这是运行 Spring 集成测试时的默认行为。
来自引用文档
If you omit both the locations and value attributes from the @ContextConfiguration annotation, the TestContext framework will attempt to detect a default XML resource location. Specifically, GenericXmlContextLoader and GenericXmlWebContextLoader detect a default location based on the name of the test class. If your class is named com.example.MyTest, GenericXmlContextLoader loads your application context from "classpath:com/example/MyTest-context.xml".
因此,它与 Maven、log4j 或资源文件夹的定位/辅助无关。
我应该担心这些消息吗?
显然,一点也不。
但我仍然觉得这些消息很烦人
不知道是否以及如何关闭该检查(当然,您可以通过将 AbstractContextLoader
的日志级别更改为 WARN
来消除它)。
关于java - Spring 集成测试 : Could not detect default resource locations,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36622871/
我正在使用 xamarin 表单开发移动应用程序,是否可以检测 Android 中的滑动手势以进行屏幕截图或单击锁定屏幕或主屏幕? 如果可以通过 Objective C/swift/java 实现,那
我刚刚涉足计算机视觉领域,并试图揭开它的各种复杂性的神秘面纱。我正在尝试使用冲浪特征检测器来增强卡尔曼滤波器。但是我不明白在使用冲浪特征在检测到的帧上构造单应性和有界矩形后如何调用和使用卡尔曼方法。在
问题 我正在尝试使用 opencv2 来检测静止图像中的 PlayStation Move 运动 Controller 。为了增加球体和背景之间的对比度,我决定修改输入图像以自动缩放每个 channe
我正在制作一个 android 应用程序,它可以从从视频中捕获的图像帧中检测对象。 openCV中的示例应用只有实时检测的例子。 附加信息:-我正在使用 Haar 分类器 截至目前,我正在将捕获的帧存
我在我的测试应用程序中成功实现了 OpenCV 平方检测示例,但现在需要过滤输出,因为它非常困惑 - 还是我的代码错误? 我对论文的四个角点感兴趣,以减少偏斜(如 that)和进一步处理......
在我的应用程序中,我想对 UIImage 使用人脸检测,所以我使用库中的 CoreImage 构建(我知道 Vision Library 也是最新的人脸检测库。但它仅支持 ios 11.0 及以上)。
我的 Linux 3.0/glibc 2.13 应用程序因以下形式的错误而停止: *** glibc detected *** MYAPP: double free or corruption (fa
我正在尝试运行一个基本程序来检测用户是否安装了 window.ethereum。当我运行我的程序时,我得到“@metamask/detect-provider:无法检测到 window.ethereu
我正在使用 Haarcascades 检测人脸和眼睛。我的问题是,它像眼睛一样包围了许多盒子。我的语法是 face_cascade = cv2.CascadeClassifier('haarcasca
我如何检测用户在对话中点击“消息”? 如果 MessageViewController Controller 很紧凑并且用户向上滑动我如何检测到它? 我试过这些代表,但它不能正常工作 override
我在对象检测中使用 Microsoft 自定义视觉服务来提取需要的对象。我想做一个回归测试来比较结果。但是,我找不到一个地方可以导出带有用户通过 GUI 定义的边界框的训练图片。 模型训练是在 Mic
我对 chrome 进行了扩展。当我浏览到 https 下的网站时,我的链接仍在 http 下,我收到:“该站点使用 SSL,但 Google Chrome 检测到页面上存在高风险不安全内容或站点证书
我用的是JetBrains的Gogland工具来学习go语言,我安装成功了,但是打不开,现将报错列如下,有没有人遇到过这个问题?如能解决,将不胜感激。 错误: Java 运行时环境检测到 fatal
我想在 R 中评估和比较我的社区检测算法的结果。我的算法不允许重叠,并且有一些节点没有被处理。例如,对于 Zachary 空手道俱乐部,我有 1 个节点未处理。我找到了很多指标(NMI、ARI、Mod
是否有任何好的开源引擎来检测文本使用的语言,也许是概率度量?我可以在本地运行并且不查询 Google 或 Bing 的一个?我想在大约 1500 万页的 OCR 文本中检测每个页面的语言。 并非所有文
我正在开发一款 2D 游戏,其中包含高速射弹,这些射弹会撞击高速(并且可能旋转得非常快)的多边形目标对象。我一直在试验和寻找适合我的强大碰撞检测算法。 如果快速旋转不是一个因素(即 0 或慢速旋转),
我正在制作一款平台游戏,其中有玩家和一些 Prop 。为了检查碰撞,我使用了 matterjs collisionactive 函数: this.matter.world.on("collisiona
我已经习惯于使用矩形进行碰撞检测,现在我有点难住了。我正在处理类似菱形的形状,在过去的几个小时里,我一直在试图找出如何检查碰撞。 我尝试检查第一个对象的四个点是否在第二个对象的点内,但这只是一个框(我
最初,两个半径为 R1 和 R2 的非接触球体处于静止状态。 然后在时间 = 0 时分别给它们两个加速度 a1 和 a2。查明他们是否会接触。它们的初始位置分别表示为 (x1,y1,z1) 和 (x2
我目前正在学习使用 LWJGL 和 OpenGL 的 ThinMatrix 3d 游戏开发教程。我正在尝试在我的游戏中实现碰撞检测。我已经准备好检测 AABB 与 AABB 碰撞的代码,但似乎无法弄清
我是一名优秀的程序员,十分优秀!