
{"id":2627,"date":"2020-12-09T09:02:28","date_gmt":"2020-12-09T01:02:28","guid":{"rendered":"http:\/\/127.0.0.2\/?p=2627"},"modified":"2020-12-10T08:41:19","modified_gmt":"2020-12-10T00:41:19","slug":"2020java%e6%a1%86%e6%9e%b6%e6%95%99%e7%a8%8b%e4%b9%8bspring%e4%bd%bf%e7%94%a8%e6%8e%a5%e5%8f%a3","status":"publish","type":"post","link":"https:\/\/www.9713job.com\/?p=2627","title":{"rendered":"2020java\u6846\u67b6\u6559\u7a0b\u4e4bspring\u4f7f\u7528\u63a5\u53e3"},"content":{"rendered":"<h3>2020java\u6846\u67b6\u6559\u7a0b\u4e4bspring\u4f7f\u7528\u63a5\u53e3<\/h3>\n<p>1.\u521b\u5efaweb\u9879\u76ee<br \/>\n2.\u5bfc\u5165jar\u5305\u4ee5\u53ca\u65e5\u5fd7\u6587\u4ef6<br \/>\n3.\u521b\u5efa\u63a5\u53e3\u4e0e\u5b9e\u73b0\u7c7b<\/p>\n<pre>\/\/\u63a5\u53e3\r\npublic interface UsersService {\r\n    void add();\r\n}<\/pre>\n<pre>@Component\r\n\/\/@Component \u8981\u5199\u5728\u5b9e\u73b0\u7c7b\u4e0a\uff0c\u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u7684\u65f6\u5019\r\n\/\/\u5c31\u4f1a\u81ea\u52a8\u626b\u63cf\u5b9e\u73b0\u7c7b\uff0c\u6765\u5c06\u8fd9\u4e2a\u7c7b\u7684\u5bf9\u8c61\u521b\u5efa\u5728spring\u7684\u5bb9\u5668\u5f53\u4e2d\r\npublic class UsersServiceImpl implements UsersService {\r\n    @Override\r\n    public void add() {\r\n        System.out.println(\"\u6dfb\u52a0\u7528\u6237\");\r\n    }\r\n}<\/pre>\n<p><!--more--><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/09\/1.jpg\" alt=\"\" width=\"680\" \/><br \/>\n4.\u521b\u5efa\u914d\u7f6e\u4fe1\u606f\u6587\u4ef6<br \/>\n5.\u521b\u5efa\u6d4b\u8bd5\u7c7b<\/p>\n<pre>@RunWith(SpringJUnit4ClassRunner.class)\/\/\u5f15\u5165\u5355\u5143\u6d4b\u8bd5\r\n\/\/\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\r\n@ContextConfiguration(classes = AppConfig.class)\r\npublic class UsersServiceTest {\r\n    @Autowired\r\n    \/\/\u6d4b\u8bd5\u7c7b\u6dfb\u52a0\u63a5\u53e3\u79c1\u6709\u5c5e\u6027\u8fdb\u884c\u81ea\u52a8\u88c5\u914d\r\n    private UsersService us;\r\n    @Test\r\n    public void test(){\r\n        us.add();\r\n    }\r\n}<\/pre>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/09\/1.png\" alt=\"\" width=\"680\" \/><br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/09\/2.png\" alt=\"\" width=\"680\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>2020java\u6846\u67b6\u6559\u7a0b\u4e4bspring\u4f7f\u7528\u63a5\u53e3 1.\u521b\u5efaweb\u9879\u76ee 2.\u5bfc\u5165jar\u5305\u4ee5\u53ca\u65e5\u5fd7\u6587\u4ef6 3.\u521b\u5efa\u63a5\u53e3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-2627","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/2627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2627"}],"version-history":[{"count":4,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/2627\/revisions"}],"predecessor-version":[{"id":2643,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/2627\/revisions\/2643"}],"wp:attachment":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}