Set System Property for JUnit Runner (Eclipse) to test a Spring Web App

大城市里の小女人 提交于 2019-12-03 04:54:36

I am working on exactly the same problem now and hopefully found the way. You can call System.setProperty() into the static initializer of your test case.

In Eclipse, right-click the JUnit test class, select Run As > Run Configurations..., then go to Arguments tab, and under VM Arguments, add in the system property entry, e.g. -Dcatalina.base=C:\programs\apache-tomcat-7.0.32

You could try to use depends-on attribute to have method invoking bean run before others

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!