public static void main(String[] args) {
String xmlPath="classpath:resource/spring-*.xml";
@SuppressWarnings("resource")
ApplicationContext ctx=new ClassPathXmlApplicationContext(xmlPath);
GoodsService goodsService=(GoodsService)ctx.getBean("goodsService");
goodsService.execute("loadTest");
}
这里的classpath:resource/spring-*.xml,该路径要以编译后的classes的路径为准,因为我classes下面有resource目录,所以添加了resource/ ,此处更具实际情况调整。