Spring5
文章平均质量分 52
JSUITDLWXL
时代造就英雄
展开
-
如果一个接口有多个实现类,在springboot中如何调用不同实现类中的方法
一个接口多个实现类,如何指定特定实现类进行调用示例解决方法在写程序的时候经常会遇到 写一个接口有多个实现类,那么在调用的时候是如何去确定调用的是哪个实现类呢?接下来将为你介绍几种方式:示例总接口public interface Animal { //动物的叫声 public void call(); //动物吃的东西 public void eat();}实现类1@Service("dogImpl")public class Dog implements A...原创 2022-01-26 14:10:34 · 6978 阅读 · 0 评论 -
Caused by: java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be ope
今天在做java Spring5中用配置文件xml来创建对象时报了一个错误,如下:Caused by: java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist报这种错误的原因就是:加载spring配置文件时路径 路径出现错误了; 所以java中加载spring配置文件applicationContext.x...原创 2021-11-24 12:25:21 · 5498 阅读 · 0 评论