Ai
1 Star 0 Fork 0

Yan Honghao/Tomcat-MyBatis

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
speech.html 2.10 KB
一键复制 编辑 原始数据 按行查看 历史
Yan Honghao 提交于 2021-11-23 00:03 +08:00 . 上传工程文件
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>今日演讲内容</title>
<style>
body {
background-color: whitesmoke;
}
div, article {
width: 60%;
margin: auto;
}
pre {
font-family: Consolas,sans-serif;
}
</style>
</head>
<body>
<div>
<h1 style="text-align: center">Spring的设计理念</h1>
<p>
控制反转(IOC)与依赖注入(DI)思想最核心的地方在于资源不由使用资源的双方管理,而由不使用资源的第三方管理。
Spring就是负责管理的第三方,项目各组件所依赖的资源由“Spring控制反转容器”统一管理调度,降低了调用资源双方的耦合度。
</p>
</div>
<div>
<h3>Spring IOC & DI</h3>
<img src="img/container-magic.png" alt="Image Loaded Error"/>
</div>
<article>
<h4>紧耦合状态:</h4>
<pre>
Class Top {
private Middle middle;
Top() {
this.middle = new Middle();
}
public void run() {
...
}
}
Class Middle {
private Bottom bottom;
Middle() {
this.bottom = new Bottom();
}
}
Class Bottom {
private Parameter param = ${Parameter};
}
初始化:
Top top = new Top();
top.run();
</pre>
<h4>实现控制反转:</h4>
<pre>
Class Top {
private Middle middle;
Top(Middle middle) {
this.middle = middle;
}
public void run() {
...
}
}
Class Middle {
private Bottom bottom;
Middle(Bottom bottom) {
this.bottom = bottom;
}
}
Class Bottom {
private int param;
Bottom(int param) {
this.param = param;
}
}
初始化:
Parameter param = new Parameter;
Bottom bottom = new Bottom(param);
Middle middle = new Middle(bottom);
Top top = new Top(middle);
top.run();
使用SpringFramework初始化:
by applicationContext.xml
@Bean
@AutoWired
new top().run();
</pre>
</article>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/CyberWorkspace/tomcat-mybatis.git
git@gitee.com:CyberWorkspace/tomcat-mybatis.git
CyberWorkspace
tomcat-mybatis
Tomcat-MyBatis
master

搜索帮助