{"id":10008073,"date":"2023-07-11T12:00:17","date_gmt":"2023-07-11T04:00:17","guid":{"rendered":"https:\/\/ityet.com\/?p=10008073"},"modified":"2023-07-11T12:00:17","modified_gmt":"2023-07-11T04:00:17","slug":"spring5-%e4%b8%ad%e6%9b%b4%e4%bc%98%e9%9b%85%e7%9a%84%e7%ac%ac%e4%b8%89%e6%96%b9-bean-%e6%b3%a8%e5%85%a5","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008073","title":{"rendered":"Spring5 \u4e2d\u66f4\u4f18\u96c5\u7684\u7b2c\u4e09\u65b9 Bean \u6ce8\u5165"},"content":{"rendered":"<p>\u5c0f\u4f19\u4f34\u4eec\u77e5\u9053\uff0c\u5f53\u6211\u4eec\u4f7f\u7528 Spring \u5bb9\u5668\u7684\u65f6\u5019\uff0c\u5982\u679c\u9047\u5230\u4e00\u4e9b\u7279\u6b8a\u7684 Bean\uff0c\u4e00\u822c\u6765\u8bf4\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u4e09\u79cd\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\uff1a<\/p>\n<ul>\n<li>\u9759\u6001\u5de5\u5382\u65b9\u6cd5<\/li>\n<li>\u5b9e\u4f8b\u5de5\u5382\u65b9\u6cd5<\/li>\n<li>FactoryBean<\/li>\n<\/ul>\n<p>\u4e0d\u8fc7\u4ece Spring5 \u5f00\u59cb\uff0c\u5728 AbstractBeandefinition \u7c7b\u4e2d\u591a\u4e86\u4e00\u4e2a\u5c5e\u6027\uff0c\u5bf9\u4e8e\u7279\u6b8a\u7684 Bean \u6211\u4eec\u6709\u4e86\u66f4\u591a\u7684\u9009\u62e9\uff1a<\/p>\n<pre><code class=\"java\">\/**\n * Specify a callback for creating an instance of the bean,\n * as an alternative to a declaratively specified factory method.\n * &lt;p&gt;If such a callback is set, it will override any other constructor\n * or factory method metadata. However, bean property population and\n * potential annotation-driven injection will still apply as usual.\n * @since 5.0\n * @see #setConstructorArgumentValues(ConstructorArgumentValues)\n * @see #setPropertyValues(MutablePropertyValues)\n *\/\npublic void setInstanceSupplier(@Nullable Supplier&lt;?&gt; instanceSupplier) {\n    this.instanceSupplier = instanceSupplier;\n}\n\n\/**\n * Return a callback for creating an instance of the bean, if any.\n * @since 5.0\n *\/\n@Nullable\npublic Supplier&lt;?&gt; getInstanceSupplier() {\n    return this.instanceSupplier;\n}<\/code><\/pre>\n<p>\u63a5\u4e0b\u6765\u677e\u54e5\u5c31\u6765\u548c\u5927\u5bb6\u7b80\u5355\u804a\u4e00\u804a\u8fd9\u4e2a\u8bdd\u9898\u3002<\/p>\n<h2>1. \u4f20\u7edf\u89e3\u51b3\u65b9\u6848<\/h2>\n<h3>1.1 \u95ee\u9898<\/h3>\n<p>\u4e0d\u77e5\u9053\u5404\u4f4d\u5c0f\u4f19\u4f34\u4eec\u6709\u6ca1\u6709\u7528\u8fc7 OkHttp\uff0c\u8fd9\u662f\u4e00\u4e2a\u4e13\u95e8\u505a\u7f51\u7edc\u8bf7\u6c42\u7684\u5de5\u5177\uff0c\u5728\u5fae\u670d\u52a1\u7684 HTTP \u8c03\u7528\u7ec4\u4ef6\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u914d\u7f6e\u5e95\u5c42\u4f7f\u7528 OkHttp \u8fd9\u4e2a\u5de5\u5177\u3002<\/p>\n<p>\u4e00\u822c\u6765\u8bf4\uff0c\u5982\u679c\u6211\u4eec\u60f3\u76f4\u63a5\u4f7f\u7528 OkHttp\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"java\">OkHttpClient client = new OkHttpClient.Builder()\n        .connectTimeout(5, TimeUnit.SECONDS)\n        .readTimeout(5, TimeUnit.SECONDS)\n        .build();\nRequest getReq = new Request.Builder().get().url(&quot;http:\/\/www.javaboy.org&quot;).build();\nCall call = client.newCall(getReq);\ncall.enqueue(new Callback() {\n    @Override\n    public void onFailure(@NotNull Call call, @NotNull IOException e) {\n        System.out.println(&quot;e.getMessage() = &quot; + e.getMessage());\n    }\n    @Override\n    public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {\n        System.out.println(&quot;response.body().string() = &quot; + response.body().string());\n    }\n});<\/code><\/pre>\n<p>\u5148\u901a\u8fc7\u5efa\u9020\u8005\u6a21\u5f0f\u521b\u5efa\u51fa\u6765\u4e00\u4e2a OkHttpClient \u5bf9\u8c61\uff0c\u7136\u540e\u8fd8\u662f\u5efa\u9020\u8005\u6a21\u5f0f\u521b\u5efa\u51fa\u6765 Request \u5bf9\u8c61\uff0c\u63a5\u4e0b\u6765\u53bb\u53d1\u9001\u8bf7\u6c42\u5c31\u53ef\u4ee5\u4e86\u3002\u90a3\u4e48\u5bf9\u4e8e\u8fd9\u6837\u7684\u4ee3\u7801\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06 OkHttpClient \u5bf9\u8c61\u4ea4\u7531 Spring \u5bb9\u5668\u7edf\u4e00\u7ba1\u7406\uff0c\u90a3\u4e48\u8be5\u5982\u4f55\u5c06 OkHttpClient \u6ce8\u518c\u5230 Spring \u5bb9\u5668\u4e2d\u5462\uff1f<\/p>\n<h3>1.2 \u9759\u6001\u5de5\u5382\u65b9\u6cd5<\/h3>\n<p>\u9996\u5148\u53ef\u4ee5\u91c7\u7528\u9759\u6001\u5de5\u5382\u65b9\u6cd5\uff0c\u4e5f\u5c31\u662f\u5de5\u5382\u65b9\u6cd5\u662f\u4e00\u4e2a\u9759\u6001\u65b9\u6cd5\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"java\">public class OkHttpStaticFactory {\n    private static OkHttpClient okHttpClient;\n    static {\n        okHttpClient = new OkHttpClient.Builder()\n                .connectTimeout(5, TimeUnit.SECONDS)\n                .readTimeout(5, TimeUnit.SECONDS)\n                .build();\n    }\n    \n    public static OkHttpClient getOkHttpClient() {\n        return okHttpClient;\n    }\n}<\/code><\/pre>\n<p>\u7136\u540e\u5728 Spring \u914d\u7f6e\u6587\u4ef6\u4e2d\u8fdb\u884c\u6ce8\u5165\uff1a<\/p>\n<pre><code class=\"xml\">&lt;bean class=&quot;org.javaboy.bean.OkHttpStaticFactory&quot; factory-method=&quot;getOkHttpClient&quot; id=&quot;httpClient&quot;\/&gt;<\/code><\/pre>\n<p>\u9759\u6001\u5de5\u5382\u7684\u7279\u70b9\u662f\u9759\u6001\u65b9\u6cd5\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528\uff0c\u5e76\u5fc5\u987b\u8981\u83b7\u53d6\u5230\u5de5\u5382\u7c7b\u7684\u5b9e\u4f8b\uff0c\u6240\u4ee5\u4e0a\u9762\u914d\u7f6e\u7684\u65f6\u5019\u53ea\u9700\u8981\u6307\u5b9a <code>factory-method<\/code> \u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>\u8fd9\u5c31\u53ef\u4ee5\u4e86\uff0c\u5c06\u6765\u6211\u4eec\u53bb Spring \u5bb9\u5668\u4e2d\u67e5\u627e\u4e00\u4e2a\u540d\u4e3a httpClient \u7684\u5bf9\u8c61\uff0c\u62ff\u5230\u624b\u7684\u5c31\u662f OkHttpClient \u4e86\u3002<\/p>\n<h3>1.3 \u5b9e\u4f8b\u5de5\u5382\u65b9\u6cd5<\/h3>\n<p>\u5b9e\u4f8b\u5de5\u5382\u65b9\u6cd5\u610f\u601d\u5c31\u662f\u8bf4\u5de5\u5382\u65b9\u6cd5\u662f\u4e00\u4e2a\u5b9e\u4f8b\u65b9\u6cd5\u3002\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"java\">public class OkHttpInstanceFactory {\n    private volatile static OkHttpClient okHttpClient;\n\n    public OkHttpClient getInstance() {\n        if (okHttpClient == null) {\n            synchronized (OkHttpInstanceFactory.class) {\n                if (okHttpClient == null) {\n                    okHttpClient = new OkHttpClient.Builder()\n                            .connectTimeout(5, TimeUnit.SECONDS)\n                            .readTimeout(5, TimeUnit.SECONDS)\n                            .build();\n                }\n            }\n        }\n        return okHttpClient;\n    }\n}<\/code><\/pre>\n<p>\u8fd9\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5355\u4f8b\u6a21\u5f0f\u3002\u4f46\u662f\u8fd9\u91cc\u7684\u5de5\u5382\u65b9\u6cd5\u662f\u4e00\u4e2a\u5b9e\u4f8b\u65b9\u6cd5\uff0c\u5b9e\u4f8b\u65b9\u6cd5\u7684\u8c03\u7528\u5fc5\u987b\u5f97\u5148\u83b7\u53d6\u5230\u5bf9\u8c61\u7136\u540e\u624d\u80fd\u8c03\u7528\u5b9e\u4f8b\u65b9\u6cd5\uff0c\u56e0\u6b64\u914d\u7f6e\u65b9\u5f0f\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"xml\">&lt;bean class=&quot;org.javaboy.bean.OkHttpInstanceFactory&quot; id=&quot;httpInstanceFactory&quot;\/&gt;\n&lt;bean factory-bean=&quot;httpInstanceFactory&quot; factory-method=&quot;getInstance&quot; id=&quot;httpClient&quot;\/&gt;<\/code><\/pre>\n<p>\u597d\u5566\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u5c31\u53ef\u4ee5\u53bb Spring \u5bb9\u5668\u4e2d\u83b7\u53d6\u4e00\u4e2a\u540d\u4e3a httpClient \u7684\u5bf9\u8c61\u4e86\uff0c\u62ff\u5230\u624b\u7684\u5c31\u662f OkHttpClient \u5b9e\u4f8b\u3002<\/p>\n<h3>1.4 FactoryBean<\/h3>\n<p>\u5f53\u7136\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7 FactoryBean \u6765\u89e3\u51b3\u4e0a\u8ff0\u95ee\u9898\uff0cFactoryBean \u677e\u54e5\u5728\u4e4b\u524d\u7684\u6587\u7ae0\u4e2d\u521a\u521a\u548c\u5927\u5bb6\u4ecb\u7ecd\u8fc7\uff0c\u6211\u4eec\u6765\u770b\u4e0b\uff1a<\/p>\n<pre><code class=\"java\">public class OkHttpClientFactoryBean implements FactoryBean&lt;OkHttpClient&gt; {\n    @Override\n    public OkHttpClient getObject() throws Exception {\n        return new OkHttpClient.Builder()\n                .connectTimeout(5, TimeUnit.SECONDS)\n                .readTimeout(5, TimeUnit.SECONDS)\n                .build();\n    }\n\n    @Override\n    public Class&lt;?&gt; getObjectType() {\n        return OkHttpClient.class;\n    }\n\n    @Override\n    public boolean isSingleton() {\n        return true;\n    }\n}<\/code><\/pre>\n<p>\u6700\u540e\u5728 Spring \u4e2d\u914d\u7f6e\u5373\u53ef\uff1a<\/p>\n<pre><code class=\"xml\">&lt;bean class=&quot;org.javaboy.bean.OkHttpClientFactoryBean&quot; id=&quot;httpClient&quot;\/&gt;<\/code><\/pre>\n<p>\u8fd9\u4e2a\u5c31\u4e0d\u505a\u8fc7\u591a\u89e3\u91ca\u4e86\uff0c\u4e0d\u719f\u6089\u7684\u5c0f\u4f19\u4f34\u53ef\u4ee5\u7ffb\u770b\u524d\u9762\u7684\u6587\u7ae0\u3002<\/p>\n<p>\u4e0a\u9762\u8fd9\u4e09\u79cd\u65b9\u6848\u90fd\u662f\u4f20\u7edf\u65b9\u6848\u3002<\/p>\n<p>\u7279\u522b\u662f\u524d\u4e24\u79cd\uff0c\u5176\u5b9e\u6211\u4eec\u7528\u7684\u6bd4\u8f83\u5c11\uff0c\u524d\u4e24\u79cd\u6709\u4e00\u4e2a\u7f3a\u9677\uff0c\u5c31\u662f\u6211\u4eec\u914d\u7f6e\u7684\u7684 factory-method \u90fd\u662f\u901a\u8fc7\u53cd\u5c04\u6765\u8c03\u7528\u7684\uff0c\u901a\u8fc7\u53cd\u5c04\u8c03\u7528\u7684\u8bdd\uff0c\u591a\u591a\u5c11\u5c11\u6027\u80fd\u53d7\u70b9\u5f71\u54cd\u3002<\/p>\n<p>\u8fd9\u79cd factory-method \u5728 Spring \u4e2d\u5904\u7406\u7684\u6e90\u7801\u6267\u884c\u65f6\u5e8f\u56fe\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043994705\" alt=\"\" title=\"\"><\/p>\n<p>\u6240\u4ee5\u6700\u7ec8\u53cd\u5c04\u662f\u5728 <code>SimpleInstantiationStrategy#instantiate<\/code> \u65b9\u6cd5\u4e2d\u6267\u884c\u7684\uff0c\u5c31\u662f\u5927\u5bb6\u975e\u5e38\u719f\u6089\u7684\u53cd\u5c04\u4ee3\u7801\u4e86\uff1a<\/p>\n<pre><code class=\"java\">@Override\npublic Object instantiate(RootBeanDefinition bd, @Nullable String beanName, BeanFactory owner,\n        @Nullable Object factoryBean, final Method factoryMethod, Object... args) {\n        ReflectionUtils.makeAccessible(factoryMethod);\n        Method priorInvokedFactoryMethod = currentlyInvokedFactoryMethod.get();\n        try {\n            currentlyInvokedFactoryMethod.set(factoryMethod);\n            Object result = factoryMethod.invoke(factoryBean, args);\n            if (result == null) {\n                result = new NullBean();\n            }\n            return result;\n        }\n        finally {\n            if (priorInvokedFactoryMethod != null) {\n                currentlyInvokedFactoryMethod.set(priorInvokedFactoryMethod);\n            }\n            else {\n                currentlyInvokedFactoryMethod.remove();\n            }\n        }\n}<\/code><\/pre>\n<p>\u597d\u4e86\uff0c\u8fd9\u662f\u4f20\u7edf\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<h2>2. Spring5 \u89e3\u51b3\u65b9\u6848<\/h2>\n<p>Spring5 \u4e2d\u5f00\u59cb\u63d0\u4f9b\u4e86 Supplier\uff0c\u53ef\u4ee5\u901a\u8fc7\u63a5\u53e3\u56de\u8c03\u83b7\u53d6\u5230\u4e00\u4e2a Bean \u7684\u5b9e\u4f8b\uff0c\u8fd9\u79cd\u65b9\u5f0f\u663e\u7136\u6027\u80fd\u66f4\u597d\u4e00\u4e9b\u3002<\/p>\n<p>\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"java\">AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();\nGenericBeanDefinition definition = new GenericBeanDefinition();\ndefinition.setBeanClass(Book.class);\ndefinition.setInstanceSupplier((Supplier&lt;Book&gt;) () -&gt; {\n    Book book = new Book();\n    book.setName(&quot;\u6df1\u5165\u6d45\u51fa Spring Security&quot;);\n    book.setAuthor(&quot;\u6c5f\u5357\u4e00\u70b9\u96e8&quot;);\n    return book;\n});\nctx.registerBeanDefinition(&quot;b1&quot;, definition);\nctx.refresh();\nBook b = ctx.getBean(&quot;b1&quot;, Book.class);\nSystem.out.println(&quot;b = &quot; + b);<\/code><\/pre>\n<p>\u5173\u952e\u5c31\u662f\u901a\u8fc7\u8c03\u7528 BeanDefinition \u7684 setInstanceSupplier \u65b9\u6cd5\u53bb\u8bbe\u7f6e\u56de\u8c03\u3002\u5f53\u7136\uff0c\u4e0a\u9762\u8fd9\u6bb5\u4ee3\u7801\u8fd8\u53ef\u4ee5\u901a\u8fc7 Lambda \u8fdb\u4e00\u6b65\u7b80\u5316\uff1a<\/p>\n<pre><code class=\"java\">public class BookSupplier {\n    public Book getBook() {\n        Book book = new Book();\n        book.setName(&quot;\u6df1\u5165\u6d45\u51fa Spring Security&quot;);\n        book.setAuthor(&quot;\u6c5f\u5357\u4e00\u70b9\u96e8&quot;);\n        return book;\n    }\n}<\/code><\/pre>\n<p>\u7136\u540e\u8c03\u7528\u8fd9\u4e2a\u65b9\u6cd5\u5373\u53ef\uff1a<\/p>\n<pre><code class=\"java\">AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();\nGenericBeanDefinition definition = new GenericBeanDefinition();\ndefinition.setBeanClass(Book.class);\nBookSupplier bookSupplier = new BookSupplier();\ndefinition.setInstanceSupplier(bookSupplier::getBook);\nctx.registerBeanDefinition(&quot;b1&quot;, definition);\nctx.refresh();\nBook b = ctx.getBean(&quot;b1&quot;, Book.class);\nSystem.out.println(&quot;b = &quot; + b);<\/code><\/pre>\n<p>\u8fd9\u662f\u4e0d\u662f\u66f4\u6709\u4e00\u70b9 Lambda \u7684\u611f\u89c9\u4e86\uff5e<\/p>\n<p>\u5728 Spring \u6e90\u7801\u4e2d\uff0c\u5904\u7406\u83b7\u53d6 Bean \u5b9e\u4f8b\u7684\u65f6\u5019\uff0c\u6709\u5982\u4e0b\u4e00\u4e2a\u5206\u652f\uff0c\u5c31\u662f\u5904\u7406 Supplier \u8fd9\u79cd\u60c5\u51b5\u7684\uff1a<\/p>\n<p>AbstractAutowireCapableBeanFactory#createBeanInstance<\/p>\n<pre><code class=\"java\">protected BeanWrapper createBeanInstance(String beanName, RootBeanDefinition mbd, @Nullable Object[] args) {\n    \/\/ Make sure bean class is actually resolved at this point.\n    Class&lt;?&gt; beanClass = resolveBeanClass(mbd, beanName);\n    if (beanClass != null &amp;&amp; !Modifier.isPublic(beanClass.getModifiers()) &amp;&amp; !mbd.isNonPublicAccessAllowed()) {\n        throw new BeanCreationException(mbd.getResourceDescription(), beanName,\n                &quot;Bean class isn't public, and non-public access not allowed: &quot; + beanClass.getName());\n    }\n    Supplier&lt;?&gt; instanceSupplier = mbd.getInstanceSupplier();\n    if (instanceSupplier != null) {\n        return obtainFromSupplier(instanceSupplier, beanName);\n    }\n    if (mbd.getFactoryMethodName() != null) {\n        return instantiateUsingFactoryMethod(beanName, mbd, args);\n    }\n    \/\/...\n    return instantiateBean(beanName, mbd);\n}\n\n@Nullable\nprivate Object obtainInstanceFromSupplier(Supplier&lt;?&gt; supplier, String beanName) {\n    String outerBean = this.currentlyCreatedBean.get();\n    this.currentlyCreatedBean.set(beanName);\n    try {\n        if (supplier instanceof InstanceSupplier&lt;?&gt; instanceSupplier) {\n            return instanceSupplier.get(RegisteredBean.of((ConfigurableListableBeanFactory) this, beanName));\n        }\n        if (supplier instanceof ThrowingSupplier&lt;?&gt; throwableSupplier) {\n            return throwableSupplier.getWithException();\n        }\n        return supplier.get();\n    }\n}<\/code><\/pre>\n<p>\u4e0a\u9762 obtainFromSupplier \u8fd9\u4e2a\u65b9\u6cd5\uff0c\u6700\u7ec8\u4f1a\u8c03\u7528\u5230\u7b2c\u4e8c\u4e2a\u65b9\u6cd5\u3002\u7b2c\u4e8c\u4e2a\u65b9\u6cd5\u4e2d\u7684 <code>supplier.get();<\/code> \u5176\u5b9e\u6700\u7ec8\u5c31\u8c03\u7528\u5230\u6211\u4eec\u81ea\u5df1\u5199\u7684 getBook \u65b9\u6cd5\u4e86\u3002<\/p>\n<p>\u597d\u5566\uff0c\u8fd9\u662f\u4ece Spring5 \u5f00\u59cb\u7ed3\u5408 Lamdba \u7684\u4e00\u79cd Bean \u6ce8\u5165\u65b9\u5f0f\uff0c\u611f\u5174\u8da3\u7684\u5c0f\u4f19\u4f34\u53ef\u4ee5\u8bd5\u8bd5\u54e6\uff5e<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000043994703\">https:\/\/segmentfault.com\/a\/1190000043994703<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c0f\u4f19\u4f34\u4eec\u77e5\u9053\uff0c\u5f53\u6211\u4eec\u4f7f\u7528 Spring \u5bb9\u5668\u7684\u65f6\u5019\uff0c\u5982\u679c\u9047\u5230\u4e00\u4e9b\u7279\u6b8a\u7684 Bean\uff0c\u4e00\u822c\u6765\u8bf4\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u4e09\u79cd\u65b9\u5f0f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10008073","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10008073"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008073\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}