代码拉取完成,页面将自动刷新
<!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>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。