Spring系列之新註解配置+Spring集成junit+註解注入

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"Spring是輕代碼而重配置的框架,配置比較繁重,影響開發效率,所以註解開發是一種趨勢,註解代替xml配置文件可以簡化配置,提高開發效率"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"你本來要寫一段很長的代碼來構造一個Beam對象,但是如果使用註解的話只要使用一個註解符號即可"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200921212449632.png#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/4a/4afa474a01541dbbbce1388e95017f3c.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200921212449632.png#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"下面我們來講講一些經常使用的註解符號"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"@Component 使用類上用於實例化Bean"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"@Controller 使用web層類上用於實例化Bean"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"@Service 使用在Service層類上用於實例化service"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"@Repository 使用在dao層類上用於實例化Bean"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"@Autorwired 使用在字段上用於根據類型依賴注入"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"@Qualifier 結合結合@Autowired一起使用根據名稱進行依賴注入"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"@Resource 相當於@Autowired+@Qualifier一起使用"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"@Scope 標註bean的範圍"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"@PostConstruct 使用該在方法上標註該方法是Bean的初始化方法"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"@PostDestory 使用在方法上標註該方法是Bean的銷燬方法"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"這三個沒有什麼區別,不過是爲了在後期讀代碼的時候更加利於我們區分,比如看到@Controller就知道這是web層,看到@Service就知道這是service層"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"@Component 使用類上用於實例化Bean\n@Controller 使用web層類上用於實例化Bean\n@Service 使用在Service層類上用於實例化service\n@Repository 使用在dao層類上用於實例化Bean\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"所以我們只需講一個即可,其他的使用方法均相同,這裏我們使用@Component來講解"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"定義一個userDaolmp類"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"package com.pjh.dao;\nimport com.pjh.dao.Imp.userdao;\nimport org.springframework.stereotype.Component;\n@Component(\"userDaoImp\")\npublic class userDaoImp implements userdao {\n public void save() {\n System.out.println(\"save\");\n }\n}\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"定義一個測試類測試"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"@Test\n public void test(){\n ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext(\"applicationContext.xml\");\n userdao userDaoImp =(userdao) classPathXmlApplicationContext.getBean(\"userDaoImp\");\n userDaoImp.save();\n }\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"然後我們就發現瞭如下報錯"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"由藍色的劃線部分我們可以看出問題是:沒有一個名叫userDaoImp的bean"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922081316893.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/2f/2f391ac247af5b2de0cc415a967754b9.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922081316893.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"這是爲什呢?因爲我們雖然寫了註解,但是我們要讓applicationContext.xml知道我們使用了註解,要告訴他哪裏有個bean。所以我們在applicationContext中還需要加入以下配置"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"命名空間"},{"type":"text","text":":xmlns:context=\""},{"type":"link","attrs":{"href":"http://www.springframework.org/schema/context","title":null},"content":[{"type":"text","text":"http://www.springframework.org/schema/context"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"約束路徑"},{"type":"text","text":":"},{"type":"link","attrs":{"href":"http://www.springframework.org/schema/context","title":null},"content":[{"type":"text","text":"http://www.springframework.org/schema/context"}]},{"type":"text","text":" "},{"type":"link","attrs":{"href":"http://www.springframework.org/schema/context/spring-context.xsd","title":null},"content":[{"type":"text","text":"http://www.springframework.org/schema/context/spring-context.xsd"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"註解的組件掃描:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":""}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"成功運行"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922082045847.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/9d/9d269cf91fcc828673e3be4e4df46dd3.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922082045847.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","marks":[{"type":"italic"}],"text":"2"},{"type":"text","text":"|"},{"type":"text","marks":[{"type":"italic"}],"text":"0"},{"type":"text","text":"接下來我們再來講講如何使用註解進行注入"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"方式一:使用@Autowired+@Qualifier"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"目的"},{"type":"text","text":":創建一個userdao類將其注入帶service類中"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"userdao類代碼"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"package com.pjh.dao;\nimport com.pjh.dao.Imp.userdao;\nimport org.springframework.stereotype.Component;\n@Component(\"userDaoImp\")\npublic class userDaoImp implements userdao {\n public void save() {\n System.out.println(\"save\");\n }\n}\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"service類代碼"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"package com.pjh.service.Imp;\nimport com.pjh.dao.Imp.userdao;\nimport com.pjh.dao.userDaoImp;\nimport com.pjh.service.service;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.beans.factory.annotation.Qualifier;\nimport org.springframework.stereotype.Repository;\nimport javax.annotation.Resource;\nimport javax.xml.bind.SchemaOutputResolver;\n\n@Repository(\"serviceImp\")\npublic class serviceImp implements service {\n @Autowired\n @Qualifier(\"userDaoImp\")\n \n private userDaoImp userDaoImp;\n public void save() {\n System.out.println(\"sssssss\");\n userDaoImp.save();\n }\n\n}\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"測試類"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"@Test\n public void test(){\n ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext(\"applicationContext.xml\");\n service service =(service) classPathXmlApplicationContext.getBean(\"serviceImp\");\n service.save();\n }\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"結果"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922082716201.png#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/c6/c63a8cc0e2a5199cf8900464a99cb905.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922082716201.png#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"方式二:使用@Resource()"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"就是把 @Autowired + @Qualifier(\"userDaoImp\")換成@Resource(name=\"userDaoImp\"),其餘代碼均與方式一相同"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"package com.pjh.service.Imp;\nimport com.pjh.dao.Imp.userdao;\nimport com.pjh.dao.userDaoImp;\nimport com.pjh.service.service;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.beans.factory.annotation.Qualifier;\nimport org.springframework.stereotype.Repository;\nimport javax.annotation.Resource;\nimport javax.xml.bind.SchemaOutputResolver;\n@Repository(\"serviceImp\")\npublic class serviceImp implements service {\n /* @Autowired\n @Qualifier(\"userDaoImp\")*/\n @Resource(name=\"userDaoImp\")\n private userDaoImp userDaoImp;\n public void save() {\n System.out.println(\"sssssss\");\n userDaoImp.save();\n }\n\n}\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"結果"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922084023247.png#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/de/de42135e12cab5f5bac5c56f62a41cba.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922084023247.png#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"令人蛋碎的事情來了,報錯了,意思是不支持版本5"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922084125530.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/e1/e10d5579449d95ac3fec3818c0f4805f.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922084125530.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"解決方案:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"File->setting下設置項目的jdk版本"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/2020092208475646.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/34/3404b432d527e8985a7e3a6214f7ac58.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/2020092208475646.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"File->ProjectStruct下設置版本"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922084858890.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/b6/b651579cc5a80fdc8053f47d3200e069.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922084858890.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"結果"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/2020092208495370.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/0f/0fb1f3cc67344cf6ea81f73edc801c30.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/2020092208495370.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"又報錯了,這。。。。。我tm心態崩了呀"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922085106310.png#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/5f/5f629e79119223b1ab50831363ec8d18.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922085106310.png#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"根據報錯的內容是報了個空指針異常,這是爲什麼呢?爲什麼使用@Autowired + @Qualifier(\"userDaoImp\")不報錯換成@Resource(name=\"userDaoImp\")就報空指針呢"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"原因"},{"type":"text","text":":jdk版本不支持"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"解決方案:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"1.更換本地的jdk版本,最好jdk1.8以上,jdk9不支持有bug"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2.再maven.pom文件中引入如下依賴"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"\n org.apache.tomcat\n tomcat-annotations-api\n 7.0.47\n \n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"結果"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"成功運行"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922085638916.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/70/70695aa602fdfd1034c2e29dbe76646a.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922085638916.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}},{"type":"text","marks":[{"type":"strong"}],"text":"終於解決完了"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922085725833.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/ac/acba3a23582e3a32ff9af548bac052c8.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922085725833.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"使用@Scope註解標註Bean的範圍"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"使用@Scope(\"prototype\")"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"package com.pjh.dao;\nimport com.pjh.dao.Imp.userdao;\nimport org.springframework.context.annotation.Scope;\nimport org.springframework.stereotype.Component;\n@Component(\"userDaoImp\")\n@Scope(\"prototype\")\npublic class userDaoImp implements userdao {\n public void save() {\n System.out.println(\"save\");\n }\n}\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"測試代碼"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"@Test\n public void test(){\n ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext(\"applicationContext.xml\");\n userdao userdao =(userdao) classPathXmlApplicationContext.getBean(\"userDaoImp\");\n userdao userdao1 =(userdao) classPathXmlApplicationContext.getBean(\"userDaoImp\");\n System.out.println(userdao);\n System.out.println(userdao1);\n }\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"結果"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922090603570.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/2f/2f2605e42da1fe777964669b71d2613c.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922090603570.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"使用@Scope(\"singleton\")"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"package com.pjh.dao;\nimport com.pjh.dao.Imp.userdao;\nimport org.springframework.context.annotation.Scope;\nimport org.springframework.stereotype.Component;\n@Component(\"userDaoImp\")\n@Scope(\"singleton\")\npublic class userDaoImp implements userdao {\n public void save() {\n System.out.println(\"save\");\n }\n}\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"結果"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/2020092209070120.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/86/86a8fd20a31c47e131eed76ad8faa144.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/2020092209070120.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"在這裏順便給大家複習複習singleton與prototype的區別吧"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"singleton"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Bean的實例化個數:1個"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Bean的實例化時機:當Spring核心配置文件被加載時"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Bean的生命週期:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"對象創建:當應用加載時對象創建"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"對象運行:只要容器在,對象就一直活着"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"對象銷燬:當應用卸載,容器銷燬時"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"prototype:在使用getBean方法的時候創建bean"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"prototype"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Bean的實例化格式:多個"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Bean的實例化時機:當調用getBean()方法時,實例化Bean"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"對象創建:當使用對象時,創建新的對象實例"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"對象運行:只要對象在使用中,對象就一直存在"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"對象銷燬:對象長時間不使用,就會被java的垃圾回收機制回收"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"初始化方法和銷燬方法"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"初始化方法"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"@PostConstract"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"@PostConstruct\n public void constract(){\n System.out.println(\"初始化方法\");\n }\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"銷燬方法"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"@PostDestroy"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":" @PreDestroy\n public void destroy(){\n System.out.println(\"在對象銷燬前執行\");\n }\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"@Value()進行注入"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"package com.pjh.dao;\nimport com.pjh.dao.Imp.userdao;\nimport com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;\nimport org.springframework.beans.factory.annotation.Value;\nimport org.springframework.context.annotation.Scope;\nimport org.springframework.stereotype.Component;\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\n@Component(\"userDaoImp\")\n@Scope(\"singleton\")\npublic class userDaoImp implements userdao {\n public void save() {\n System.out.println(\"save\");\n System.out.println(\"讀取配置文件:\"+one);\n System.out.println(\"普通類型:\"+a);\n }\n @Value(\"${one.one}\")\n private String one;\n @Value(\"4\")\n private String a;\n\n}\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"配置文件信息"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"one.one=1\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"applicationContext中添加的內容"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":" \n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"測試代碼"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"@Test\n public void test(){\n ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext(\"applicationContext.xml\");\n userdao userdao =(userdao) classPathXmlApplicationContext.getBean(\"userDaoImp\");\n userdao.save();\n }\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"結果"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922094336949.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/22/220f980bc044d6ad02a97ea2a80b8fe4.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922094336949.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"使用上面的註解還不可以全部替代xml配置文件,還需要使用註解替代的配置如下"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"非自定義的Bean的配置:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"加載properties文件的配置:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"註解掃描的配置:context:component-scan"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"引入其他文件:"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","marks":[{"type":"italic"}],"text":"3"},{"type":"text","text":"|"},{"type":"text","marks":[{"type":"italic"}],"text":"0"},{"type":"text","text":"Spring新註解"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"@Configuration"},{"type":"text","text":" 用於指定當前類是一個Spring配置類,創建容器時會從該類上加載註解,該類不能是匿名類與final類"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"@ComponentScan"},{"type":"text","text":" 用於指定Spring在初始化容器的時候要掃描包"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"作用與Spring中的此代碼相同:context:component-scan"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"@Bean"},{"type":"text","text":" 使用方法,將該方法的返回值返回到容器中"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"@Import"},{"type":"text","text":" 用於導入其他配置類"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"@PropertySource"},{"type":"text","text":" 用於加載properties文件中的配置"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"案例"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"核心配置類"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"package com.pjh.config;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.context.annotation.Import;\nimport org.springframework.stereotype.Component;\n/*標誌該類是核心配置類*/\n@Configuration\n/*掃描包*/\n@Component(\"com/pjh\")\n/*導入其他配置類*/\n@Import(DataSourceConfig.class)\npublic class Springconfig {\n}\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"副配置類"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"package com.pjh.config;\nimport com.mchange.v2.c3p0.ComboPooledDataSource;\nimport org.springframework.beans.factory.annotation.Value;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.PropertySource;\nimport javax.sql.DataSource;\nimport java.beans.PropertyVetoException;\n/*加載配置文件*/\n@PropertySource(\"classpath:jdbc.properties\")\npublic class DataSourceConfig {\n @Value(\"${jdbc.driver}\")\n private String driver;\n @Value(\"${jdbc.url}\")\n private String url;\n @Value(\"${jdbc.username}\")\n private String username;\n @Value(\"${jdbc.password}\")\n private String password;\n /*Spring會將當前方法的返回值以指定名稱存儲到Spring容器中*/\n @Bean(\"dataSource\") \n public DataSource getDataSource() throws PropertyVetoException {\n ComboPooledDataSource dataSource = new ComboPooledDataSource();\n dataSource.setDriverClass(driver);\n dataSource.setJdbcUrl(url);\n dataSource.setUser(username);\n dataSource.setPassword(password);\n return dataSource;\n }\n}\n\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"測試函數"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"@Test\n public void test() throws SQLException {\n ApplicationContext applicationContext = new\n AnnotationConfigApplicationContext(Springconfig.class);\n DataSource bean = (DataSource)applicationContext.getBean(\"dataSource\");\n Connection connection = bean.getConnection();\n System.out.println(connection);\n }\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"結果"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"成功創建connection連接"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922184238237.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/df/df84f9d152aad9b47a8c98d815714b0b.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922184238237.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3BqaDg4,size_16,color_FFFFFF,t_70#pic_center","title":null}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","marks":[{"type":"italic"}],"text":"4"},{"type":"text","text":"|"},{"type":"text","marks":[{"type":"italic"}],"text":"0"},{"type":"text","text":"Spring集成junit"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"爲什麼使用Spring集成junit?"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在測試類中每個類都要寫下面的兩行代碼"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"ApplicationContext applicationContext = new\n AnnotationConfigApplicationContext(Springconfig.class);\n DataSource bean = (DataSource)applicationContext.getBean(\"dataSource\");\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"這兩行代碼的作用是獲取容器,不寫的話報空指針異常"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"爲了讓我們測試的時候不用進行反覆的寫上述兩行的操作,我們使用Spring來集成junit,用springjunit來創建spring容器,"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我們只需將配置文件的名稱告訴他們即可,將需要的bean直接在容器中進行注入"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"Spring集成junit的步驟"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"需要導入的jar包"}]},{"type":"codeblock","attrs":{"lang":null},"content":[{"type":"text","text":"\n org.springframework\n spring-test\n 5.0.2.RELEASE\n \n \n junit\n junit\n 4.13\n test\n \n"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","marks":[{"type":"italic"}],"text":"5"},{"type":"text","text":"|"},{"type":"text","marks":[{"type":"italic"}],"text":"0"},{"type":"text","text":"這是我spring系列的學習文章,我也會不斷的學習,文章如有錯誤還請批評指正,如有幫助大家可以點點關注,我們一同學習"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922201913237.png#pic_center","title":null}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/6f/6f10ce548c53cceed4767e1a571f6562.png","alt":"在這裏插入圖片描述","title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://img-blog.csdnimg.cn/20200922201913237.png#pic_center","title":null}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章