public static void main(String[] args) { SpringApplication application = new SpringApplication(PrivilegeCommonMain.class); Set<Object> sourcesSet = new HashSet<Object>(); // sourcesSet.add("classpath:spring/applicationContext.xml"); sourcesSet.add("classpath:spring/*.xml"); application.setSources(sourcesSet); application.run(args); }
@Override public ApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception { SpringApplication application = getSpringApplication(); application.setSources(getSources(mergedConfig)); if (!ObjectUtils.isEmpty(mergedConfig.getActiveProfiles())) { application.setAdditionalProfiles(mergedConfig.getActiveProfiles()); } application.setDefaultProperties(getArgs(mergedConfig)); List<ApplicationContextInitializer<?>> initializers = getInitializers(mergedConfig, application); if (mergedConfig instanceof WebMergedContextConfiguration) { new WebConfigurer().configure(mergedConfig, application, initializers); } else { application.setWebEnvironment(false); } application.setInitializers(initializers); return application.run(); }