The classpath*: I think has a limitation doesn’t work for files under the root folder.

Try moving the files under a folder - something like spring/application-a.xml and spring/application-b.xml. Then you can have a path classpath*:/spring/application-*.xml.

https://mkyong.com/spring/load-multiple-spring-bean-configuration-file/?__cf_chl_captcha_tk__=dd3238171dfb2d3aae0ddb8f542c67721b542669-1589954701-0-AYZ43wYjD81hR9lq9e3LeIu3Y3GqHIQB9MFMAq8LHNhtYF3s0_b7uZdrly0LCdHTr17V5awTO400FGjCSd_OG2OaCkfBm33JHl_oFNEsjSrLH3IzhOT6kt32KcWfo5vyGroazAjeKHh9lRcZnFiXZwxIYZliADETfPvvfwlOXLDIZC-_vEvov2Iauen3Gtuqpe_RHy_6xLxBTZb534oDxpG6wxVc-hiWNz-plA55GY-ozN4lkH1jqrDrgnVwGo_InlHcEpE9t72Cocx4xr58BDr9Ko3GQ9H-qKrsWpHpp6VFxklnoZa5S5W6fjURjbRJ-v4t42wnLdHs0lKJuQ6olEfV9XiGxKquk0Ux6ONjFzbMyZ_rF9V-5TRBlOK4s5BWk6bKJc_SQw4kI2lS-tLcoFnbdG6SQk4cydcX3eFqSEVI_KjM08-mbW2k6EDmQntRxg

ClassPathXmlApplicationContext

ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
RegisterDAO registerDAO = (RegisterDAO)ac.getBean("RegisterDAO");


ApplicationContext ac = new ClassPathXmlApplicationContext(new String[]{"applicationContext.xml","dao.xml"});

ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:/*.xml");

DispatcherServlet 类的作用?

classpath* 和 classpath 使用

classpath* 它会搜索所有的 classpath,找到所有符合条件的文件,包括当前项目依赖的jar文件中的配置文件。而classpath不会到当前项目依赖的jar文件中去寻找。 classpath* 存在可移植性问题,遇到问题时,应该使用classpath.