{"id":529,"date":"2023-03-23T21:19:42","date_gmt":"2023-03-23T13:19:42","guid":{"rendered":""},"modified":"2023-03-23T21:19:42","modified_gmt":"2023-03-23T13:19:42","slug":"Spring \u6559\u7a0b","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/529.html","title":{"rendered":"Spring \u6559\u7a0b"},"content":{"rendered":"


\n <\/head>
\n <\/p>\n

\n

Spring \u6559\u7a0b<\/h1>\n<\/p><\/div>\n

Spring \u6559\u7a0b_https:\/\/bianchenghao6.com_\u3010Spring \u6559\u7a0b\u3011_\u7b2c1\u5f20 <\/p>\n

\n \u672cSpring\u6559\u7a0b\u901a\u8fc7\u7b80\u5316\u793a\u4f8b\u63d0\u4f9b\u4e86Spring Framework\u7684\u6df1\u5165\u6982\u5ff5\u3002\u5b83\u662f
\n \u7531Rod Johnson\u57282003\u5e74\u5f00\u53d1\u7684<\/strong>\u3002 Spring\u6846\u67b6\u4f7fJavaEE\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u53d8\u5f97\u5bb9\u6613\u3002\n <\/div>\n
\n \u8fd9\u5bf9\u521d\u5b66\u8005\u548c\u7ecf\u9a8c\u4e30\u5bcc\u7684\u4eba\u5f88\u6709\u5e2e\u52a9\u3002\n <\/div>\n

Spring\u6846\u67b6<\/h2>\n
\n Spring\u662f\u4e00\u4e2a
\n lightweight(\u8f7b\u91cf\u7ea7) <\/em>\u6846\u67b6\u3002\u53ef\u4ee5\u5c06\u5176\u89c6\u4e3a\u6846\u67b6\u7684
\n \u6846\u67b6<\/em>\uff0c\u56e0\u4e3a\u5b83\u4e3a\u5404\u79cd\u6846\u67b6\u63d0\u4f9b\u4e86\u652f\u6301\uff0c\u4f8b\u5982 Struts\uff0cHibernate\uff0cTapestry\uff0cEJB\uff0cJSF \u7b49\u3002\u4ece\u5e7f\u4e49\u4e0a\u8bb2\uff0c\u53ef\u4ee5\u5b9a\u4e49\u4e3a\u4e00\u79cd\u7ed3\u6784\uff0c\u53ef\u4ee5\u5728\u5176\u4e2d\u627e\u5230\u5404\u79cd\u6280\u672f\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\u3002\n <\/div>\n
\n Spring\u6846\u67b6\u5305\u542b\u51e0\u4e2a\u6a21\u5757\uff0c\u4f8b\u5982IOC\uff0cAOP\uff0cDAO\uff0cContext\uff0cORM\uff0cWEB MVC\u7b49\u3002\u6211\u4eec\u5c06\u5728\u4e0b\u4e00\u9875\u4e2d\u5b66\u4e60\u8fd9\u4e9b\u6a21\u5757\u3002\u9996\u5148\u8ba9\u6211\u4eec\u4e86\u89e3IOC\u548c\u4f9d\u8d56\u6ce8\u5165\u3002\n <\/div>\n
\n

\u63a7\u5236\u53cd\u8f6c(IOC)\u548c\u4f9d\u8d56\u6ce8\u5165<\/h3>\n
\n \u8fd9\u4e9b\u662f\u8bbe\u8ba1\u6a21\u5f0f\uff0c\u7528\u4e8e\u4ece\u7f16\u7a0b\u4ee3\u7801\u4e2d\u5220\u9664\u4f9d\u8d56\u9879\u3002\u5b83\u4eec\u4f7f\u4ee3\u7801\u66f4\u6613\u4e8e\u6d4b\u8bd5\u548c\u7ef4\u62a4\u3002\u8ba9\u6211\u4eec\u7528\u4ee5\u4e0b\u4ee3\u7801\u6765\u4e86\u89e3\u8fd9\u4e00\u70b9:\n <\/div>\n
\n
\r\nclass <\/span>Employee{\r\nAddress address;\r\nEmployee(){\r\naddress=new Address();\r\n}\r\n}\r\n<\/pre>\n

<\/code>\n <\/div>\n

\n \u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0cEmployee\u548cAddress\u4e4b\u95f4\u5b58\u5728\u4f9d\u8d56\u6027(\u7d27\u5bc6\u8026\u5408)\u3002\u5728\"\u63a7\u5236\u53cd\u8f6c\"\u65b9\u6848\u4e2d\uff0c\u6211\u4eec\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c:\n <\/div>\n
\n
\r\nclass <\/span>Employee{\r\nAddress address;\r\nEmployee(Address address){\r\nthis<\/span>.address=address;\r\n}\r\n}\r\n<\/pre>\n

<\/code>\n <\/div>\n

\n \u56e0\u6b64\uff0cIOC\u4f7f\u4ee3\u7801\u677e\u6563\u8026\u5408\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u6211\u4eec\u7684\u903b\u8f91\u79fb\u81f3\u65b0\u73af\u5883\uff0c\u5219\u65e0\u9700\u4fee\u6539\u4ee3\u7801\u3002\n <\/div>\n
\n \u5728Spring\u6846\u67b6\u4e2d\uff0cIOC\u5bb9\u5668\u8d1f\u8d23\u6ce8\u5165\u4f9d\u8d56\u9879\u3002\u6211\u4eec\u901a\u8fc7XML\u6587\u4ef6\u6216\u6ce8\u91ca\u5c06\u5143\u6570\u636e\u63d0\u4f9b\u7ed9IOC\u5bb9\u5668\u3002\n <\/div>\n

\u4f9d\u8d56\u6ce8\u5165\u7684\u4f18\u52bf<\/h3>\n

\u4f7f\u4ee3\u7801\u677e\u6563\u8026\u5408\uff0c\u56e0\u6b64\u6613\u4e8e\u7ef4\u62a4<\/span>
\n \u4f7f\u4ee3\u7801\u6613\u4e8e\u6d4b\u8bd5<\/span> <\/p>\n


\n

Spring Framework\u7684\u4f18\u52bf<\/h3>\n
\n Spring Framework\u6709\u5f88\u591a\u4f18\u70b9\u3002\u5b83\u4eec\u5982\u4e0b:\n <\/div>\n
\n 1\u3001\u9884\u5b9a\u4e49\u6a21\u677f<\/strong>\n <\/div>\n
\n Spring\u6846\u67b6\u63d0\u4f9b\u4e86JDBC\uff0cHibernate\uff0cJPA\u7b49\u6280\u672f\u7684\u6a21\u677f\u3002\u56e0\u6b64\uff0c\u65e0\u9700\u7f16\u5199\u8fc7\u591a\u7684\u4ee3\u7801\u3002\u5b83\u9690\u85cf\u4e86\u8fd9\u4e9b\u6280\u672f\u7684\u57fa\u672c\u6b65\u9aa4\u3002\n <\/div>\n
\n \u8ba9\u6211\u4eec\u4ee5JdbcTemplate\u4e3a\u4f8b\uff0c\u60a8\u65e0\u9700\u7f16\u5199\u4ee3\u7801\u6765\u5904\u7406\u5f02\u5e38\uff0c\u521b\u5efa\u8fde\u63a5\uff0c\u521b\u5efa\u8bed\u53e5\uff0c\u63d0\u4ea4\u4e8b\u52a1\uff0c\u5173\u95ed\u8fde\u63a5\u7b49\u3002\u60a8\u53ea\u9700\u8981\u7f16\u5199\u6267\u884c\u67e5\u8be2\u7684\u4ee3\u7801\u3002\u8fd9\u6837\uff0c\u5b83\u8282\u7701\u4e86\u5927\u91cf\u7684JDBC\u4ee3\u7801\u3002\n <\/div>\n
\n 2\u3001\u677e\u8026\u5408<\/strong>\n <\/div>\n
\n \u7531\u4e8e\u4f9d\u8d56\u9879\u6ce8\u5165\uff0cSpring\u5e94\u7528\u7a0b\u5e8f\u677e\u6563\u8026\u5408\u3002\n <\/div>\n
\n 3\u3001\u6613\u4e8e\u6d4b\u8bd5 <\/strong>\n <\/div>\n
\n \u4f9d\u8d56\u6ce8\u5165\u4f7f\u6d4b\u8bd5\u5e94\u7528\u7a0b\u5e8f\u66f4\u52a0\u5bb9\u6613\u3002 EJB\u6216Struts\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u670d\u52a1\u5668\u6765\u8fd0\u884c\u8be5\u5e94\u7528\u7a0b\u5e8f\uff0c\u4f46Spring\u6846\u67b6\u4e0d\u9700\u8981\u670d\u52a1\u5668\u3002\n <\/div>\n
\n 4\u3001\u8f7b\u5de7 <\/strong>\n <\/div>\n
\n Spring\u6846\u67b6\u7531\u4e8e\u5176POJO\u800c\u8f7b\u5de7\u5b9e\u65bd\u3002 Spring Framework\u4e0d\u4f1a\u5f3a\u8feb\u7a0b\u5e8f\u5458\u7ee7\u627f\u4efb\u4f55\u7c7b\u6216\u5b9e\u73b0\u4efb\u4f55\u63a5\u53e3\u3002\u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u5b83\u88ab\u79f0\u4e3a\u975e\u4fb5\u5165\u6027\u7684\u3002\n <\/div>\n
\n 5\u3001\u5feb\u901f\u5f00\u53d1 <\/strong>\n <\/div>\n
\n Spring Framework\u7684\u4f9d\u8d56\u6ce8\u5165\u529f\u80fd\u53ca\u5176\u5bf9\u5404\u79cd\u6846\u67b6\u7684\u652f\u6301\u4f7f\u5f00\u53d1\u53d8\u5f97\u5bb9\u6613\n <\/div>\n
\n 6\u3001\u5f3a\u5927\u7684\u62bd\u8c61 <\/strong>\n <\/div>\n
\n \u5b83\u4e3aJavaEE\u89c4\u8303(\u4f8b\u5982 JMS, JDBC, JPA and JTA\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u62bd\u8c61\u3002\n <\/div>\n
\n 7\u3001\u58f0\u660e\u5f0f\u652f\u6301 <\/strong>\n <\/div>\n
\n \u5b83\u4e3a\u4ee5\u4e0b\u5185\u5bb9\u63d0\u4f9b\u58f0\u660e\u5f0f\u652f\u6301: \u7f13\u5b58\uff0c\u9a8c\u8bc1\uff0c\u4e8b\u52a1\u548c\u683c\u5f0f\u3002\n <\/div>\n
\n

Spring\u7d22\u5f15<\/h2>\n
\n