方法一:使用@ImportResource
方法二:在test中
@ContextConfiguration(locations = "classpath:spring-profile.xml")
方法三:使用@PropertySource
方法四:方法四:使用SpringApplication.setSources()
博客地址:https://blog.csdn.net/xiang__liu,https://www.cnblogs.com/xiang--liu/