在Intellij中运行测试时,如何指定Spring Boot配置文件
使用Intellij,我可以指定启动服务时运行的弹簧启动配置文件
但是,如果我运行MVN CLEAN install
,则使用默认配置文件运行测试,这会导致它们失败。如何告诉MVN使用特定的弹簧启动配置文件运行测试?
With IntelliJ, I can specify a Spring boot profile to run when starting a service
However, if I run mvn clean install
, then the tests are run with the default profile, which causes them to fail. How can I tell mvn to run the tests with a specific Spring Boot profile?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建/定义属性文件,然后将其放入您的
src/test/Resources
文件夹中。使用类级别注释
@ActiveProfiles
并指定您的属性文件名,例如@ActiveProfiles(“ myproperties”)
希望这会有所帮助!
Create/define a properties file and put it within your
src/test/resources
folder.Use class level annotation
@ActiveProfiles
and specify your property file name like this@ActiveProfiles("myProperties")
Hope this helps!