您可以在静态初始化程序中初始化System属性:
@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(locations = "classpath:whereever/context.xml")public class TestWarSpringContext { static { System.setProperty("myproperty", "foo"); }}静态初始化程序代码将在spring应用程序上下文初始化之前执行。



