{"id":1658,"date":"2018-06-13T13:09:36","date_gmt":"2018-06-13T05:09:36","guid":{"rendered":"http:\/\/www.netxintai.com\/?p=1658"},"modified":"2024-11-26T20:28:50","modified_gmt":"2024-11-26T12:28:50","slug":"sping%e6%95%99%e7%a8%8b-%e5%85%a5%e9%97%a8%e6%a1%88%e4%be%8b%e4%b8%80","status":"publish","type":"post","link":"https:\/\/www.netxintai.com\/?p=1658","title":{"rendered":"Sping\u6559\u7a0b&#8211;\u5165\u95e8\u6848\u4f8b(\u4e00)"},"content":{"rendered":"<p><strong><span style=\";font-family:\u5b8b\u4f53;font-size:28px\">Spring\u6982\u5ff5<\/span><\/strong><\/p>\n<p><span style=\";font-family:\u5b8b\u4f53;font-size:28px\">1spring\u662f\u5f00\u6e90\u7684\u8f7b\u91cf\u7ea7\u6846\u67b6<\/span><\/p>\n<p><span style=\";font-family:\u5b8b\u4f53;font-size:28px\">2spring\u6838\u5fc3\u4e3b\u8981\u4e24\u90e8\u5206<\/span><\/p>\n<p style=\"text-indent:28px\">1\uff09Aop:\u9762\u5411\u5207\u9762\u7f16\u7a0b\uff0c\u6269\u5c55\u529f\u80fd\u4e0d\u662f\u4fee\u6539\u6e90\u4ee3\u7801\u5b9e\u73b0<\/p>\n<p style=\"text-indent:28px\">2\uff09Ioc:\u63a7\u5236\u53cd\u8f6c\uff0c<\/p>\n<p style=\"text-indent:28px\">&nbsp; &nbsp; -\u6bd4\u5982\u6709\u4e2a\u7c7b\uff0c\u5728\u7c7b\u91cc\u9762\u6709\u65b9\u6cd5\uff08\u4e0d\u662f\u9759\u6001\u7684\u65b9\u6cd5\uff09\uff0c\u8c03\u7528\u7c7b\u91cc\u9762\u7684\u65b9\u6cd5\uff0c\u521b\u5efa\u7c7b\u7684\u5bf9\u8c61\uff0c\u4f7f\u7528\u5bf9\u8c61\u8c03\u7528\u65b9\u6cd5\uff0c\u521b\u5efa\u7c7b\u5bf9\u8c61\u7684\u8fc7\u7a0b\uff0c\u9700\u8981\u51fa\u6765\u5bf9\u8c61<\/p>\n<p style=\"text-indent:28px\">&nbsp; &nbsp; -\u628a\u5bf9\u8c61\u7684\u521b\u5efa\u4e0d\u662f\u901a\u8fc7\u65b9\u5f0f\u5b9e\u73b0\uff0c\u800c\u662f\u4ea4\u7ed9\u914d\u7f6e\u521b\u5efa\u7c7b\u5bf9\u8c61<\/p>\n<p><span style=\";font-family:\u5b8b\u4f53;font-size:28px\"> 3spring\u662f\u4e00\u7ad9\u5f0f\u6846\u67b6<\/span><\/p>\n<p style=\"text-indent:28px\">1)spring\u5728javaee\u4e09\u5c42\u7ed3\u6784\u4e2d\uff0c\u6bcf\u4e00\u5c42\u90fd\u63d0\u4f9b\u4e0d\u540c\u7684\u89e3\u51b3\u6280\u672f<\/p>\n<p style=\"text-indent:28px\">-web\u5c42 springMVC<\/p>\n<p style=\"text-indent:28px\">-service\u5c42 spring\u7684ioc<\/p>\n<p style=\"text-indent:28px\">-dao\u5c42 spring\u7684jdbcTemplate<\/p>\n<p style=\"text-indent:28px\">4 spring\u7248\u672c<\/p>\n<p style=\"text-indent:28px\">\uff081\uff09hibernate5.x<\/p>\n<p style=\"text-indent:28px\">\uff082\uff09Spring4.x<\/p>\n<p>Spring\u7684IOC\u64cd\u4f5c<\/p>\n<p>1 \u628a\u5bf9\u8c61\u7684\u521b\u5efa\u4ea4\u7ed9spring\u8fdb\u884c\u7ba1\u7406<\/p>\n<p>2 ioc\u64cd\u4f5c\u4e24\u90e8\u5206<\/p>\n<p style=\"text-indent:28px\">1\uff09ioc\u7684\u914d\u7f6e\u6587\u4ef6\u65b9\u5f0f<\/p>\n<p style=\"text-indent:28px\">2\uff09Ioc\u61c2\u5f97\u6ce8\u89e3\u65b9\u5f0f<\/p>\n<p>Ioc\u5e95\u5c42\u539f\u7406<\/p>\n<p>1 ioc\u5e95\u5c42\u539f\u7406 \u4f7f\u7528\u6280\u672f<\/p>\n<p style=\"text-indent:28px\">1\uff09xml\u914d\u7f6e\u6587\u4ef6<\/p>\n<p style=\"text-indent:28px\">2\uff09Dom4j\u89e3\u51b3xml<\/p>\n<p style=\"text-indent:28px\">3\uff09\u5de5\u5382\u8bbe\u8ba1\u6a21\u5f0f<\/p>\n<p style=\"text-indent:28px\">4\uff09\u53cd\u5c04<\/p>\n<p><img decoding=\"async\" src=\"\/ueditor\/php\/upload\/image\/20180613\/1528861355139637.jpg\" style=\"\" title=\"1528861355139637.jpg\"\/><\/p>\n<p><img decoding=\"async\" src=\"\/ueditor\/php\/upload\/image\/20180613\/1528861355187344.jpg\" style=\"\" title=\"1528861355187344.jpg\"\/><\/p>\n<p style=\"text-indent:28px\">\u5165\u95e8\u6848\u5217<\/p>\n<p style=\"text-indent:28px\">\u7b2c\u4e00\u6b65\u5bfc\u5165jar\u5305<\/p>\n<p><img decoding=\"async\" src=\"\/ueditor\/php\/upload\/image\/20180613\/1528861553874066.png\" title=\"1528861553874066.png\" alt=\"\u5305\u6587\u4ef6.png\"\/><\/p>\n<p>&nbsp; &nbsp;\u7b2c\u4e8c\u6b65 \u521b\u5efa\u7c7b\u548c\u7c7b\u4e2d\u7684\u65b9\u6cd5<\/p>\n<pre class=\"brush:java;toolbar:false\">package&nbsp;com.netxintai.domain;\r\n\r\npublic&nbsp;class&nbsp;User&nbsp;{\r\n\t\tprivate&nbsp;String&nbsp;username;\r\n\t\tprivate&nbsp;String&nbsp;password;\r\n\t\t\r\n\t\tpublic&nbsp;void&nbsp;add(){\r\n\t\t\t\r\n\t\t\tSystem.out.println(&quot;\u6dfb\u52a0\u7528\u6237\u64cd\u4f5c&quot;);\r\n\t\t}\r\n}<\/pre>\n<p>&nbsp; &nbsp;\u7b2c\u4e09\u6b65\u5f15\u5165\u7ea6\u675f\u6587\u4ef6<\/p>\n<pre class=\"brush:xml;toolbar:false\">&lt;?xml&nbsp;version=&quot;1.0&quot;&nbsp;encoding=&quot;UTF-8&quot;?&gt;\r\n&lt;beans&nbsp;xmlns=&quot;http:\/\/www.springframework.org\/schema\/beans&quot;\r\n&nbsp;&nbsp;&nbsp;&nbsp;xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;\r\n&nbsp;&nbsp;&nbsp;&nbsp;xsi:schemaLocation=&quot;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http:\/\/www.springframework.org\/schema\/beans&nbsp;http:\/\/www.springframework.org\/schema\/beans\/spring-beans.xsd&quot;&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;bean&nbsp;id=&quot;user&quot;&nbsp;class=&quot;com.netxintai.domain.User&quot;&gt;&lt;\/bean&gt;\r\n&nbsp;&lt;\/beans&gt;<\/pre>\n<p>\u7b2c\u56db\u6b65\u521b\u5efa\u6d4b\u8bd5\u65b9\u6cd5\u548c\u83b7\u53d6\u5bf9\u8c61<\/p>\n<pre class=\"brush:java;toolbar:false\">package&nbsp;com.netxintai.action;\r\n\r\nimport&nbsp;org.junit.Test;\r\nimport&nbsp;org.springframework.context.ApplicationContext;\r\nimport&nbsp;org.springframework.context.support.ClassPathXmlApplicationContext;\r\n\r\nimport&nbsp;com.netxintai.domain.User;\r\n\r\npublic&nbsp;class&nbsp;TestApplicaion&nbsp;{\r\n\t\r\n\t\r\n\t@Test\r\n\tpublic&nbsp;void&nbsp;test(){\r\n\t\t\r\n\t\tApplicationContext&nbsp;context=new&nbsp;ClassPathXmlApplicationContext(&quot;applicationContext.xml&quot;);\r\n\t\t\r\n\t\tUser&nbsp;user=(User)&nbsp;context.getBean(&quot;user&quot;);\r\n\t\tuser.add();\r\n\t}\r\n\r\n}<\/pre>\n<p>\u63a7\u5236\u53f0\u8f93\u51fa\u6d4b\u8bd5\u7ed3\u679c<\/p>\n<p><img decoding=\"async\" src=\"\/ueditor\/php\/upload\/image\/20180613\/1528866453782253.png\" title=\"1528866453782253.png\" alt=\"image.png\"\/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring\u6982\u5ff5 1spring\u662f\u5f00\u6e90\u7684\u8f7b\u91cf\u7ea7\u6846\u67b6 2spring\u6838\u5fc3\u4e3b\u8981\u4e24\u90e8\u5206 1\uff09Aop:\u9762\u5411\u5207\u9762\u7f16\u7a0b\uff0c\u6269 <span class=\"ellipsis\">&hellip;<\/span> <span class=\"more-link-wrap\"><a href=\"https:\/\/www.netxintai.com\/?p=1658\" class=\"more-link\"><span>Read More &rarr;<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":1491,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[48],"tags":[169,170],"_links":{"self":[{"href":"https:\/\/www.netxintai.com\/index.php?rest_route=\/wp\/v2\/posts\/1658"}],"collection":[{"href":"https:\/\/www.netxintai.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.netxintai.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.netxintai.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.netxintai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1658"}],"version-history":[{"count":3,"href":"https:\/\/www.netxintai.com\/index.php?rest_route=\/wp\/v2\/posts\/1658\/revisions"}],"predecessor-version":[{"id":1661,"href":"https:\/\/www.netxintai.com\/index.php?rest_route=\/wp\/v2\/posts\/1658\/revisions\/1661"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.netxintai.com\/index.php?rest_route=\/wp\/v2\/media\/1491"}],"wp:attachment":[{"href":"https:\/\/www.netxintai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.netxintai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.netxintai.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}