{"id":554,"date":"2024-05-31T11:52:17","date_gmt":"2024-05-31T03:52:17","guid":{"rendered":"https:\/\/www.tqazy.com\/?p=554"},"modified":"2024-05-31T12:47:22","modified_gmt":"2024-05-31T04:47:22","slug":"value","status":"publish","type":"post","link":"https:\/\/www.tqazy.com\/?p=554","title":{"rendered":"@Value"},"content":{"rendered":"<h1>@Value<\/h1>\n<h2>\u6982\u5ff5<\/h2>\n<p><code>@Value<\/code> \u662fSpring\u6846\u67b6\u63d0\u4f9b\u7684\u4e00\u4e2a\u6ce8\u89e3\uff0c\u4e3b\u8981\u7528\u4e8e\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u5c5e\u6027\u503c\u5e76\u6ce8\u5165\u5230Bean\u7684\u5b57\u6bb5\u6216\u65b9\u6cd5\u4e2d\u3002<\/p>\n<p>\u5b83\u5c5e\u4e8eSpring Expression Language (SpEL) \u7684\u4e00\u90e8\u5206\uff0c\u80fd\u591f\u652f\u6301\u590d\u6742\u7684\u8868\u8fbe\u5f0f\u89e3\u6790\uff0c\u4f46\u6700\u5e38\u89c1\u7684\u662f\u7528\u6765\u8bfb\u53d6\u7b80\u5355\u7684\u5c5e\u6027\u503c\u3002<\/p>\n<h2>\u901a\u4fd7\u8bf4\u6cd5<\/h2>\n<p>\u60f3\u8c61\u4e00\u4e0b\uff0c<code>@Value<\/code> \u5c31\u50cf\u662f\u4e00\u4e2a\u667a\u80fd\u7684\u5feb\u9012\u5c0f\u54e5\uff0c\u5b83\u7684\u4e3b\u8981\u5de5\u4f5c\u662f\u5728\u4f60\u5bb6\u2014\u2014\u4e5f\u5c31\u662f\u4f60\u7684Spring\u9879\u76ee\u4e2d\uff0c\u5e2e\u4f60\u6536\u53d6\u914d\u7f6e\u6587\u4ef6\u8fd9\u4e2a\u201c\u5feb\u9012\u7bb1\u201d\u91cc\u7684\u5305\u88f9\u2014\u2014\u5404\u79cd\u914d\u7f6e\u5c5e\u6027\u3002<\/p>\n<p>\u6bcf\u4e2a\u5305\u88f9\u4e0a\u90fd\u6709\u4e00\u4e2a\u5730\u5740\u6807\u7b7e\uff0c\u6bd4\u5982 <code class=\"kb-btn\">${database.password}<\/code> \uff0c\u8fd9\u4e2a\u5feb\u9012\u5c0f\u54e5\uff08<code>@Value<\/code>\uff09\u5c31\u6839\u636e\u8fd9\u4e2a\u6807\u7b7e\uff0c\u51c6\u786e\u65e0\u8bef\u5730\u627e\u5230\u5bf9\u5e94\u7684\u5305\u88f9\uff08\u503c\uff09\uff0c\u7136\u540e\u4eb2\u624b\u9001\u5230\u4f60\u5bb6\u7684\u6307\u5b9a\u623f\u95f4\u2014\u2014\u53ef\u80fd\u662f\u67d0\u4e2aBean\u7684\u5c5e\u6027\u91cc\uff0c\u4e5f\u53ef\u80fd\u662f\u4e00\u4e2a\u65b9\u6cd5\u91cc\uff0c\u5c31\u50cf\u662f\u628a\u5feb\u9012\u7cbe\u51c6\u6295\u9012\u5230\u4f60\u7684\u4e66\u684c\u6216\u53a8\u623f\u3002<\/p>\n<p>\u6709\u65f6\u5019\uff0c\u8fd9\u4e2a\u5feb\u9012\u5c0f\u54e5\u8fd8\u80fd\u505a\u70b9\u989d\u5916\u7684\u4e8b\u60c5\uff0c\u6bd4\u5982\u6839\u636e\u4f60\u5bb6\u7684\u7279\u6b8a\u8981\u6c42\uff08SpEL\u8868\u8fbe\u5f0f\uff09\uff0c\u5728\u9001\u5feb\u9012\u7684\u540c\u65f6\uff0c\u5e2e\u4f60\u68c0\u67e5\u5305\u88f9\u91cc\u662f\u5426\u6709\u989d\u5916\u7684\u5c0f\u793c\u7269\uff08\u8fdb\u884c\u6761\u4ef6\u5224\u65ad\u6216\u7b80\u5355\u7684\u5904\u7406\uff09\u3002\u4f46\u65e5\u5e38\u751f\u6d3b\u4e2d\uff0c\u6211\u4eec\u5927\u591a\u65f6\u5019\u53ea\u662f\u4eab\u53d7\u5b83\u5e2e\u5fd9\u5feb\u901f\u51c6\u786e\u9001\u8fbe\u57fa\u7840\u5305\u88f9\u7684\u4fbf\u5229\u3002<\/p>\n<h2>\u6240\u5c5e<\/h2>\n<blockquote>\n<p>import org.springframework.beans.factory.annotation.Value;<\/p>\n<\/blockquote>\n<h2>\u4f5c\u7528<\/h2>\n<ul>\n<li><strong>\u5c5e\u6027\u6ce8\u5165\uff1a<\/strong> \u5141\u8bb8\u4f60\u76f4\u63a5\u4ece\u914d\u7f6e\u6587\u4ef6\uff08\u5982 <code>application.properties<\/code> \u6216 <code>application.yml<\/code> \uff09\u4e2d\u8bfb\u53d6\u503c\uff0c\u5e76\u5c06\u5176\u6ce8\u5165\u5230Bean\u7684\u5b57\u6bb5\u6216\u914d\u7f6e\u65b9\u6cd5\u4e2d\u3002<\/li>\n<li><strong>\u7b80\u5316\u914d\u7f6e\u7ba1\u7406\uff1a<\/strong> \u901a\u8fc7\u5916\u90e8\u5316\u914d\u7f6e\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u66f4\u6539\u5e94\u7528\u7a0b\u5e8f\u8bbe\u7f6e\uff0c\u800c\u65e0\u9700\u4fee\u6539\u4ee3\u7801\u3002<\/li>\n<li><strong>\u7075\u6d3b\u6027\uff1a<\/strong> \u652f\u6301SpEL\u8868\u8fbe\u5f0f\uff0c\u56e0\u6b64\u53ef\u4ee5\u8fdb\u884c\u66f4\u590d\u6742\u7684\u503c\u5904\u7406\u548c\u8ba1\u7b97\u3002<\/li>\n<\/ul>\n<h2>\u7528\u6cd5<\/h2>\n<p>@Value(&quot;${propertyKey}&quot;)\uff0c\u7528\u4e8e\u6ce8\u5165\u5916\u90e8\u914d\u7f6e\u7684\u503c\u3002<\/p>\n<h3>\u57fa\u672c\u8bed\u6cd5<\/h3>\n<p><code>@Value(&quot;${propertyKey}&quot;)<\/code>\uff0c\u7528\u4e8e\u6ce8\u5165\u5916\u90e8\u914d\u7f6e\u7684\u503c\u3002<\/p>\n<h3>\u914d\u7f6e\u6e90<\/h3>\n<ul>\n<li><strong>.properties\u6587\u4ef6\uff1a<\/strong> \u4f7f\u7528 <code class=\"kb-btn\">${key}<\/code> \u5f15\u7528\u914d\u7f6e\u9879\u3002<\/li>\n<li><strong>.yml\u6587\u4ef6\uff1a<\/strong> \u652f\u6301\u5c5e\u6027\u8def\u5f84\uff0c\u5982 <code>app.db.url<\/code> \uff0c\u5bf9\u5e94 <code>app: db: url: ...<\/code>\u3002<\/li>\n<\/ul>\n<h3>SpEL\u96c6\u6210<\/h3>\n<p>\u652f\u6301\u7b80\u5355\u8868\u8fbe\u5f0f\uff0c\u5982\u6761\u4ef6\u5224\u65ad\uff1a<code class=\"kb-btn\">#{condition ? &#039;trueVal&#039; : &#039;falseVal&#039;}<\/code>\u3002<br \/>\n\u8bbf\u95ee\u73af\u5883\u53d8\u91cf\u4e0e\u7cfb\u7edf\u5c5e\u6027\uff1a\u5982 <code class=\"kb-btn\">#{systemProperties[&#039;envVar&#039;]}<\/code>\u3002<\/p>\n<h2>\u4f7f\u7528\u573a\u666f<\/h2>\n<ul>\n<li><strong>\u914d\u7f6e\u53c2\u6570\u6ce8\u5165\uff1a<\/strong> \u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u3001\u90ae\u4ef6\u670d\u52a1\u5668\u8bbe\u7f6e\u7b49\u5e94\u7528\u914d\u7f6e\u4fe1\u606f\u3002<\/li>\n<li><strong>\u73af\u5883\u7279\u5b9a\u914d\u7f6e\uff1a<\/strong> \u6839\u636e\u4e0d\u540c\u73af\u5883\uff08\u5f00\u53d1\u3001\u6d4b\u8bd5\u3001\u751f\u4ea7\uff09\u52a0\u8f7d\u4e0d\u540c\u7684\u914d\u7f6e\u503c\u3002<\/li>\n<li><strong>\u52a8\u6001\u8ba1\u7b97\u503c\uff1a<\/strong> \u57fa\u4e8e\u5df2\u6709\u914d\u7f6e\u6216\u7cfb\u7edf\u5c5e\u6027\u8fdb\u884c\u8ba1\u7b97\u5f97\u5230\u7684\u503c\u3002<\/li>\n<\/ul>\n<h2>\u4f7f\u7528\u793a\u4f8b<\/h2>\n<h3>\u57fa\u672c\u7528\u6cd5<\/h3>\n<p><strong>1\u3001\u76f4\u63a5\u5728\u5b57\u6bb5\u4e0a\u4f7f\u7528\uff0c\u4ece\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bfb\u53d6\u7b80\u5355\u503c\u3002<\/strong><\/p>\n<p>\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u7b80\u5355\u7684\u5c5e\u6027\u6ce8\u5165\u9700\u6c42\uff0c\u6211\u4eec\u5c06\u4ece\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bfb\u53d6\u4e00\u4e2a\u5b57\u7b26\u4e32\u503c\u3002<\/p>\n<p>\u9996\u5148\u770b\u914d\u7f6e\u6587\u4ef6\uff08\u8fd9\u91cc\u4ee5 <code>application.properties<\/code> \u4e3a\u4f8b\uff09\uff1a<\/p>\n<pre><code class=\"language-properties\"># application.properties\ngreeting.message=Welcome to our application!<\/code><\/pre>\n<p>\u7136\u540e\u5728Java\u4ee3\u7801\u4e2d\u4f7f\u7528 <code>@Value<\/code> \u57fa\u672c\u7528\u6cd5\u6765\u6ce8\u5165\u8fd9\u4e2a\u914d\u7f6e\u503c\uff1a<\/p>\n<pre><code class=\"language-java\">import org.springframework.beans.factory.annotation.Value;\nimport org.springframework.stereotype.Component;\n\n@Component\npublic class GreetingService {\n\n    @Value(&quot;${greeting.message}&quot;)\n    private String greetingMessage;\n\n    public void displayGreeting() {\n        System.out.println(greetingMessage);\n    }\n}<\/code><\/pre>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code class=\"kb-btn\">${greeting.message}<\/code> \u4f1a\u88ab\u89e3\u6790\u6210 <code>application.properties<\/code> \u4e2d\u5b9a\u4e49\u7684 <code>greeting.message<\/code> \u7684\u503c\u3002<\/p>\n<p><strong>2\u3001\u4e5f\u53ef\u4ee5\u5728\u914d\u7f6e\u7c7b\u7684\u65b9\u6cd5\u4e2d\u4f7f\u7528\uff0c\u5b9e\u73b0\u52a8\u6001\u914d\u7f6e\u3002<\/strong><\/p>\n<p>\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u540d\u4e3a <code>application.yml<\/code> \u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5176\u4e2d\u5305\u542b\u4e00\u4e9b\u5e94\u7528\u914d\u7f6e\u4fe1\u606f\uff1a<\/p>\n<pre><code class=\"language-yml\"># application.yml\napp:\n  database:\n    url: jdbc:mysql:\/\/localhost:3306\/mydb\n    username: myuser\n    password: mypassword<\/code><\/pre>\n<p>\u5728\u8fd9\u4e2aYAML\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u6211\u4eec\u5b9a\u4e49\u4e86\u4e00\u4e2a <code>app.database<\/code> \u90e8\u5206\uff0c\u5305\u62ec\u6570\u636e\u5e93\u8fde\u63a5\u7684URL\u3001\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u521b\u5efa\u4e00\u4e2aSpring\u914d\u7f6e\u7c7b\uff0c\u4f7f\u7528 <code>@Value<\/code> \u6ce8\u89e3\u4ece <code>application.yml<\/code> \u4e2d\u8bfb\u53d6\u8fd9\u4e9b\u5c5e\u6027\u503c\uff1a<\/p>\n<pre><code class=\"language-java\">import org.springframework.beans.factory.annotation.Value;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\nimport javax.sql.DataSource;\nimport org.springframework.jdbc.datasource.DriverManagerDataSource;\n\n@Configuration\npublic class DatabaseConfig {\n\n    @Value(&quot;${app.database.url}&quot;)\n    private String dbUrl;\n\n    @Value(&quot;${app.database.username}&quot;)\n    private String dbUsername;\n\n    @Value(&quot;${app.database.password}&quot;)\n    private String dbPassword;\n\n    @Bean\n    public DataSource dataSource() {\n        DriverManagerDataSource dataSource = new DriverManagerDataSource();\n        dataSource.setUrl(dbUrl);\n        dataSource.setUsername(dbUsername);\n        dataSource.setPassword(dbPassword);\n        return dataSource;\n    }\n}<\/code><\/pre>\n<p>\u5728\u8fd9\u4e2a\u914d\u7f6e\u7c7b <code>DatabaseConfig<\/code> \u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 <code>@Value<\/code> \u6ce8\u89e3\u76f4\u63a5\u4ece <code>application.yml<\/code> \u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u8fde\u63a5\u7684URL\u3001\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u5e76\u5c06\u8fd9\u4e9b\u503c\u6ce8\u5165\u5230\u76f8\u5e94\u7684\u5b57\u6bb5\u4e2d\u3002<\/p>\n<p>\u7136\u540e\uff0c\u6211\u4eec\u5b9a\u4e49\u4e86\u4e00\u4e2a <code>dataSource<\/code> Bean\uff0c\u8be5Bean\u4f7f\u7528\u4e86\u8fd9\u4e9b\u914d\u7f6e\u503c\u6765\u914d\u7f6e\u4e00\u4e2a <code>DriverManagerDataSource<\/code> \u5b9e\u4f8b\u3002<\/p>\n<h3>SpEL\u7528\u6cd5<\/h3>\n<p>\u901a\u5e38 <code>@Value<\/code> \u76f4\u63a5\u7528\u4e8e\u8bfb\u53d6\u914d\u7f6e\u503c\u65f6\u5e76\u4e0d\u76f4\u63a5\u7ed3\u5408\u590d\u6742\u7684SpEL\u8868\u8fbe\u5f0f\u3002<\/p>\n<p>\u4e0d\u8fc7\uff0c<code>@Value<\/code> \u786e\u5b9e\u652f\u6301SpEL\u8868\u8fbe\u5f0f\u4f5c\u4e3a\u5176\u503c\u7684\u4e00\u90e8\u5206\uff0c\u7528\u4e8e\u66f4\u7075\u6d3b\u7684\u503c\u89e3\u6790\u3002<\/p>\n<p>\u4e0b\u9762\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u5c06\u8bf4\u660e\u5982\u4f55\u5728SpEL\u7684\u4e0a\u4e0b\u6587\u4e2d\u4f7f\u7528 <code>@Value<\/code> \u6765\u5b9e\u73b0\u4e00\u4e2a\u57fa\u672c\u7684\u6761\u4ef6\u5224\u65ad\u903b\u8f91\uff0c\u5373\u4f7f\u8fd9\u4e2a\u903b\u8f91\u8f83\u4e3a\u7b80\u5355\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u4fdd\u6301 <code>application.properties<\/code> \u914d\u7f6e\u6587\u4ef6\u76f8\u5bf9\u7b80\u5355\uff0c\u4e0d\u76f4\u63a5\u5728YAML\u4e2d\u4f7f\u7528SpEL\u8868\u8fbe\u5f0f\uff0c\u800c\u662f\u5b9a\u4e49\u4e00\u4e9b\u57fa\u7840\u914d\u7f6e\uff1a<\/p>\n<pre><code class=\"language-yml\"># application.yml\napp:\n  welcomeMessage: Welcome to our app!\n  debugMode: false<\/code><\/pre>\n<p>\u8fd9\u91cc\uff0c\u6211\u4eec\u5b9a\u4e49\u4e86\u4e24\u4e2a\u5c5e\u6027\uff1a\u4e00\u4e2a\u6b22\u8fce\u6d88\u606f <code>welcomeMessage<\/code> \u548c\u4e00\u4e2a\u5e03\u5c14\u578b\u7684\u8c03\u8bd5\u6a21\u5f0f\u6807\u5fd7 <code>debugMode<\/code> \u3002<\/p>\n<p>\u7136\u540e\uff0c\u5728Java\u914d\u7f6e\u7c7b\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u5229\u7528SpEL\u6765\u57fa\u4e8edebugMode\u7684\u503c\u52a8\u6001\u51b3\u5b9a\u662f\u5426\u6dfb\u52a0\u989d\u5916\u7684\u8c03\u8bd5\u4fe1\u606f\uff1a<\/p>\n<pre><code class=\"language-java\">import org.springframework.beans.factory.annotation.Value;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\npublic class AppConfig {\n\n    @Value(&quot;${app.welcomeMessage}&quot;)\n    private String welcomeMessage;\n\n    @Value(&quot;#{${app.debugMode} ? &#039; [Debug Mode Enabled]&#039; : &#039;&#039;}&quot;)\n    private String debugInfo;\n\n    public void displayWelcomeMessage() {\n        System.out.println(welcomeMessage + debugInfo);\n    }\n}<\/code><\/pre>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u867d\u7136\u76f4\u63a5\u5728 <code>@Value<\/code> \u4e2d\u4f7f\u7528\u4e86SpEL\u8868\u8fbe\u5f0f <code class=\"kb-btn\">#{${app.debugMode} ? &#039; [Debug Mode Enabled]&#039; : &#039;&#039;}<\/code> \uff0c\u4f46\u5b9e\u9645\u4e0a\u8fd9\u79cd\u5199\u6cd5\u662f\u4e3a\u4e86\u6f14\u793a\u76ee\u7684\u7b80\u5316\u4e86\u903b\u8f91\u3002<\/p>\n<p>\u5b83\u68c0\u67e5 <code>app.debugMode<\/code> \u7684\u503c\uff0c\u5e76\u6839\u636e\u5176\u771f\u5047\u51b3\u5b9a\u9644\u52a0\u4fe1\u606f\u3002\u5982\u679c <code>debugMode<\/code> \u4e3a <code>true<\/code> \uff0c\u5219\u8f93\u51fa\u7684\u6d88\u606f\u540e\u4f1a\u8ffd\u52a0 <code>[Debug Mode Enabled]<\/code> \uff0c\u5426\u5219\u9644\u52a0\u7a7a\u5b57\u7b26\u4e32\u3002<\/p>\n<p>\u8bf7\u6ce8\u610f\uff0c\u76f4\u63a5\u5728 <code>@Value<\/code> \u4e2d\u5d4c\u5957 <code class=\"kb-btn\">${...}<\/code> \u7684\u65b9\u5f0f\u5e76\u4e0d\u5e38\u89c1\uff08\u662f\u5d4c\u5957\u975e\u76f4\u63a5\u4f7f\u7528\uff09\uff0c\u8fd9\u66f4\u591a\u662f\u4e3a\u4e86\u8bf4\u660eSpEL\u7684\u4f7f\u7528\u53ef\u80fd\u6027\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u80fd\u66f4\u503e\u5411\u4e8e\u4f7f\u7528\u66f4\u76f4\u63a5\u7684\u914d\u7f6e\u6216\u901a\u8fc7\u5176\u4ed6\u9ad8\u7ea7\u7279\u6027\u5982 <code>@ConditionalOnProperty<\/code> \u6765\u63a7\u5236\u903b\u8f91\u6d41\u7a0b\u3002<\/p>\n<h2>\u6ce8\u610f\u4e8b\u9879<\/h2>\n<ul>\n<li>\u907f\u514d\u786c\u7f16\u7801\uff0c\u63d0\u9ad8\u914d\u7f6e\u7075\u6d3b\u6027\u3002<\/li>\n<li>\u73af\u5883\u7279\u5b9a\u914d\u7f6e\u9700\u8003\u8651\u9ed8\u8ba4\u503c\u4e0e Profile\u3002<\/li>\n<li>\u5bf9\u4e8e\u5927\u91cf\u914d\u7f6e\uff0c\u63a8\u8350\u7ed3\u5408 <a href=\"https:\/\/www.tqazy.com\/?p=562\"><code>@ConfigurationProperties<\/code><\/a>\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>@Value \u6982\u5ff5 @Value \u662fSpring\u6846\u67b6\u63d0\u4f9b\u7684\u4e00\u4e2a\u6ce8\u89e3\uff0c\u4e3b\u8981\u7528\u4e8e\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u5c5e\u6027\u503c\u5e76\u6ce8\u5165\u5230Be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42],"tags":[43],"class_list":["post-554","post","type-post","status-publish","format-standard","hentry","category-42","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>@Value | \u9676\u5176\u7684\u4e2a\u4eba\u535a\u5ba2<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.tqazy.com\/?p=554\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"@Value | \u9676\u5176\u7684\u4e2a\u4eba\u535a\u5ba2\" \/>\n<meta property=\"og:description\" content=\"@Value \u6982\u5ff5 @Value \u662fSpring\u6846\u67b6\u63d0\u4f9b\u7684\u4e00\u4e2a\u6ce8\u89e3\uff0c\u4e3b\u8981\u7528\u4e8e\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u5c5e\u6027\u503c\u5e76\u6ce8\u5165\u5230Be [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.tqazy.com\/?p=554\" \/>\n<meta property=\"og:site_name\" content=\"\u9676\u5176\u7684\u4e2a\u4eba\u535a\u5ba2\" \/>\n<meta property=\"article:published_time\" content=\"2024-05-31T03:52:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-31T04:47:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/oss.tqazy.com\/wordpress\/autoFile\/2024\/05\/20240530090910445.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"\u9676\u5176\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u9676\u5176\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.tqazy.com\/?p=554#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.tqazy.com\/?p=554\"},\"author\":{\"name\":\"\u9676\u5176\",\"@id\":\"https:\/\/www.tqazy.com\/#\/schema\/person\/b2e89d56e70f15c261012417c5ef2c4e\"},\"headline\":\"@Value\",\"datePublished\":\"2024-05-31T03:52:17+00:00\",\"dateModified\":\"2024-05-31T04:47:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.tqazy.com\/?p=554\"},\"wordCount\":46,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.tqazy.com\/#\/schema\/person\/b2e89d56e70f15c261012417c5ef2c4e\"},\"keywords\":[\"\u6ce8\u89e3\"],\"articleSection\":[\"\u6ce8\u89e3\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.tqazy.com\/?p=554#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tqazy.com\/?p=554\",\"url\":\"https:\/\/www.tqazy.com\/?p=554\",\"name\":\"@Value | \u9676\u5176\u7684\u4e2a\u4eba\u535a\u5ba2\",\"isPartOf\":{\"@id\":\"https:\/\/www.tqazy.com\/#website\"},\"datePublished\":\"2024-05-31T03:52:17+00:00\",\"dateModified\":\"2024-05-31T04:47:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.tqazy.com\/?p=554#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.tqazy.com\/?p=554\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.tqazy.com\/?p=554#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.tqazy.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"@Value\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.tqazy.com\/#website\",\"url\":\"https:\/\/www.tqazy.com\/\",\"name\":\"\u9676\u5176\u7684\u4e2a\u4eba\u535a\u5ba2\",\"description\":\"\u5f53\u4e0b\uff0c\u5373\u662f\u672a\u6765\",\"publisher\":{\"@id\":\"https:\/\/www.tqazy.com\/#\/schema\/person\/b2e89d56e70f15c261012417c5ef2c4e\"},\"alternateName\":\"TaoQi's Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.tqazy.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.tqazy.com\/#\/schema\/person\/b2e89d56e70f15c261012417c5ef2c4e\",\"name\":\"\u9676\u5176\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.tqazy.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/oss.tqazy.com\/wordpress\/autoFile\/2024\/06\/20240604021741672.jpg\",\"contentUrl\":\"https:\/\/oss.tqazy.com\/wordpress\/autoFile\/2024\/06\/20240604021741672.jpg\",\"width\":940,\"height\":940,\"caption\":\"\u9676\u5176\"},\"logo\":{\"@id\":\"https:\/\/www.tqazy.com\/#\/schema\/person\/image\/\"},\"description\":\"\u4e00\u4e2a\u5f88\u61d2\u7684\u7a0b\u5e8f\u5458\",\"sameAs\":[\"https:\/\/www.tqazy.com\"],\"url\":\"https:\/\/www.tqazy.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"@Value | \u9676\u5176\u7684\u4e2a\u4eba\u535a\u5ba2","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.tqazy.com\/?p=554","og_locale":"zh_CN","og_type":"article","og_title":"@Value | \u9676\u5176\u7684\u4e2a\u4eba\u535a\u5ba2","og_description":"@Value \u6982\u5ff5 @Value \u662fSpring\u6846\u67b6\u63d0\u4f9b\u7684\u4e00\u4e2a\u6ce8\u89e3\uff0c\u4e3b\u8981\u7528\u4e8e\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u5c5e\u6027\u503c\u5e76\u6ce8\u5165\u5230Be [&hellip;]","og_url":"https:\/\/www.tqazy.com\/?p=554","og_site_name":"\u9676\u5176\u7684\u4e2a\u4eba\u535a\u5ba2","article_published_time":"2024-05-31T03:52:17+00:00","article_modified_time":"2024-05-31T04:47:22+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/oss.tqazy.com\/wordpress\/autoFile\/2024\/05\/20240530090910445.jpg","type":"image\/jpeg"}],"author":"\u9676\u5176","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u9676\u5176","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.tqazy.com\/?p=554#article","isPartOf":{"@id":"https:\/\/www.tqazy.com\/?p=554"},"author":{"name":"\u9676\u5176","@id":"https:\/\/www.tqazy.com\/#\/schema\/person\/b2e89d56e70f15c261012417c5ef2c4e"},"headline":"@Value","datePublished":"2024-05-31T03:52:17+00:00","dateModified":"2024-05-31T04:47:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.tqazy.com\/?p=554"},"wordCount":46,"commentCount":0,"publisher":{"@id":"https:\/\/www.tqazy.com\/#\/schema\/person\/b2e89d56e70f15c261012417c5ef2c4e"},"keywords":["\u6ce8\u89e3"],"articleSection":["\u6ce8\u89e3"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.tqazy.com\/?p=554#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.tqazy.com\/?p=554","url":"https:\/\/www.tqazy.com\/?p=554","name":"@Value | \u9676\u5176\u7684\u4e2a\u4eba\u535a\u5ba2","isPartOf":{"@id":"https:\/\/www.tqazy.com\/#website"},"datePublished":"2024-05-31T03:52:17+00:00","dateModified":"2024-05-31T04:47:22+00:00","breadcrumb":{"@id":"https:\/\/www.tqazy.com\/?p=554#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.tqazy.com\/?p=554"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.tqazy.com\/?p=554#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.tqazy.com\/"},{"@type":"ListItem","position":2,"name":"@Value"}]},{"@type":"WebSite","@id":"https:\/\/www.tqazy.com\/#website","url":"https:\/\/www.tqazy.com\/","name":"\u9676\u5176\u7684\u4e2a\u4eba\u535a\u5ba2","description":"\u5f53\u4e0b\uff0c\u5373\u662f\u672a\u6765","publisher":{"@id":"https:\/\/www.tqazy.com\/#\/schema\/person\/b2e89d56e70f15c261012417c5ef2c4e"},"alternateName":"TaoQi's Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.tqazy.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.tqazy.com\/#\/schema\/person\/b2e89d56e70f15c261012417c5ef2c4e","name":"\u9676\u5176","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.tqazy.com\/#\/schema\/person\/image\/","url":"https:\/\/oss.tqazy.com\/wordpress\/autoFile\/2024\/06\/20240604021741672.jpg","contentUrl":"https:\/\/oss.tqazy.com\/wordpress\/autoFile\/2024\/06\/20240604021741672.jpg","width":940,"height":940,"caption":"\u9676\u5176"},"logo":{"@id":"https:\/\/www.tqazy.com\/#\/schema\/person\/image\/"},"description":"\u4e00\u4e2a\u5f88\u61d2\u7684\u7a0b\u5e8f\u5458","sameAs":["https:\/\/www.tqazy.com"],"url":"https:\/\/www.tqazy.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/www.tqazy.com\/index.php?rest_route=\/wp\/v2\/posts\/554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tqazy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tqazy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tqazy.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tqazy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=554"}],"version-history":[{"count":0,"href":"https:\/\/www.tqazy.com\/index.php?rest_route=\/wp\/v2\/posts\/554\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tqazy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tqazy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tqazy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}