@ContextConfiguration注解说明

  • @ContextConfiguration : 加载配置文件
    • @ContextConfiguration(classes = {TestConfig.class})
    • @ContextConfiguration用来加载ApplicationContext 
    • classes属性用来加载配置类

比如:

  单个文件 @ContextConfiguration(Locations="../applicationContext.xml")

  @ContextConfiguration(classes = SimpleConfiguration.class)

  多个文件时,可用

  @ContextConfiguration(locations = { "classpath*:/spring1.xml", "classpath*:/spring2.xml" })

posted @ 2018-09-27 21:45  魔瞳  阅读(8152)  评论(0编辑  收藏  举报