java - Spring/Springboot Autowire 场景结果
问题描述
以下场景在编译时和运行时对于 MyProjectService 的行为将是什么:
Beans XML 配置:
<bean id="myProjectService" class="com.someco.MyProjectService" />
Java 代码:
@Component
public class MyClient implements IClient {
@Autowired(required = false)
private MyProjectService MyProject;
}
请注意 XML 中的 bean id 和客户端类中的变量名。
无论如何,当引用用于调用类上的某些方法时,这会在运行时抛出NoClassDefFoundError吗?MyProject
MyProjectService
解决方案
推荐阅读
- android - 为什么当我遇到真实设备或模拟器时没有显示此 TextViews
- python-3.x - 以编程方式平移散景 GMap
- verification - 达夫尼没有验证琐碎的断言
- c# - 即使我对类型进行了限定,但为什么在两个程序集中存在此类型时会出现错误?
- python - IGRAPH Python - 如何找到模块化的源代码?
- angular - Angular Bitbucket Pipeline 无法运行 ng build
- java - 带有通配符的通用接口。'?扩展类'不是'类'
- node.js - 在 apache 后面运行节点显示页面(代码)而不是执行页面
- c++ - 无法获取进程的开始时间
- google-apps-script - 运行包含 If 语句的应用程序脚本代码(如何自动触发?) - Google Apps 脚本/Google 表格