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.
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.