{"id":8,"date":"2025-02-11T10:25:20","date_gmt":"2025-02-11T02:25:20","guid":{"rendered":"http:\/\/cxycd.cn\/?p=8"},"modified":"2025-02-11T10:25:20","modified_gmt":"2025-02-11T02:25:20","slug":"spring-boot-3-4-%e6%ad%a3%e5%bc%8f%e5%8f%91%e5%b8%83%ef%bc%8c%e7%8e%8b%e7%82%b8%e7%ba%a7%e6%9b%b4%e6%96%b0%ef%bc%81","status":"publish","type":"post","link":"http:\/\/cxycd.cn\/index.php\/2025\/02\/11\/spring-boot-3-4-%e6%ad%a3%e5%bc%8f%e5%8f%91%e5%b8%83%ef%bc%8c%e7%8e%8b%e7%82%b8%e7%ba%a7%e6%9b%b4%e6%96%b0%ef%bc%81\/","title":{"rendered":"Spring Boot 3.4 \u6b63\u5f0f\u53d1\u5e03\uff0c\u738b\u70b8\u7ea7\u66f4\u65b0\uff01"},"content":{"rendered":"\n<p>Spring Boot 3.4.0 \u7248\u672c\u5728\u914d\u7f6e\u5c5e\u6027\u7684\u652f\u6301\u4e0a\u8fdb\u884c\u4e86\u663e\u8457\u589e\u5f3a\uff0c\u4f7f\u5f97\u5f00\u53d1\u8005\u80fd\u591f\u66f4\u7075\u6d3b\u5730\u7ba1\u7406\u548c\u4f7f\u7528\u5e94\u7528\u7a0b\u5e8f\u7684\u914d\u7f6e\u3002\u65b0\u7684\u7279\u6027\u5305\u62ec\u5bf9\u914d\u7f6e\u5c5e\u6027\u7684\u6539\u8fdb\u3001\u7c7b\u578b\u5b89\u5168\u589e\u5f3a\u3001\u4ee5\u53ca\u5bf9\u73af\u5883\u53d8\u91cf\u7684\u66f4\u597d\u652f\u6301\u3002\u8fd9\u4e9b\u6539\u8fdb\u65e8\u5728\u63d0\u5347\u5f00\u53d1\u6548\u7387\u548c\u4ee3\u7801\u53ef\u8bfb\u6027\uff0c\u540c\u65f6\u7b80\u5316\u914d\u7f6e\u8fc7\u7a0b\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u589e\u5f3a\u7684\u914d\u7f6e\u5c5e\u6027\u652f\u6301\uff0c\u63d0\u4f9b\u5177\u4f53\u7684\u4f7f\u7528\u793a\u4f8b\u548c\u573a\u666f\u4f18\u5316\uff0c\u5e76\u4e0e 3.3 \u7248\u672c\u8fdb\u884c\u5bf9\u6bd4\u3002<\/p>\n\n\n\n<p><strong>1. \u589e\u5f3a\u7684\u914d\u7f6e\u5c5e\u6027\u652f\u6301\u6982\u8ff0<\/strong><\/p>\n\n\n\n<p>\u5728 Spring Boot 3.4.0 \u4e2d\uff0c\u589e\u5f3a\u7684\u914d\u7f6e\u5c5e\u6027\u652f\u6301\u4e3b\u8981\u4f53\u73b0\u5728\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\uff1a<\/p>\n\n\n\n<p>\u7c7b\u578b\u5b89\u5168\u914d\u7f6e\uff1a\u589e\u5f3a\u4e86\u5bf9\u914d\u7f6e\u5c5e\u6027\u7684\u9a8c\u8bc1\u548c\u7c7b\u578b\u5b89\u5168\u652f\u6301\u3002<\/p>\n\n\n\n<p>\u652f\u6301\u591a\u79cd\u914d\u7f6e\u6e90\uff1a\u5f15\u5165\u4e86\u5bf9\u4e0d\u540c\u914d\u7f6e\u6e90\uff08\u5982 YAML\u3001properties\u3001\u73af\u5883\u53d8\u91cf\u7b49\uff09\u7684\u7edf\u4e00\u652f\u6301\u3002<\/p>\n\n\n\n<p>\u66f4\u597d\u7684 IDE \u652f\u6301\uff1a\u589e\u5f3a\u7684 IntelliJ IDEA \u548c\u5176\u4ed6 IDE \u7684\u652f\u6301\uff0c\u63d0\u9ad8\u4e86\u5f00\u53d1\u8005\u7684\u5de5\u4f5c\u6548\u7387\u3002<\/p>\n\n\n\n<p><strong>2. \u65b0\u7279\u6027\u8be6\u89e3<\/strong><\/p>\n\n\n\n<p><strong>2.1 \u7c7b\u578b\u5b89\u5168\u914d\u7f6e<\/strong><\/p>\n\n\n\n<p><strong>\u8be6\u7ec6\u8bf4\u660e<\/strong><\/p>\n\n\n\n<p>Spring Boot 3.4.0 \u5f15\u5165\u4e86\u66f4\u597d\u7684\u7c7b\u578b\u5b89\u5168\u914d\u7f6e\uff0c\u901a\u8fc7 @ConfigurationProperties \u6ce8\u89e3\uff0c\u4f7f\u5f97\u914d\u7f6e\u5c5e\u6027\u7684\u7ed1\u5b9a\u548c\u9a8c\u8bc1\u53d8\u5f97\u66f4\u52a0\u7b80\u5355\u548c\u76f4\u89c2\u3002<\/p>\n\n\n\n<p><strong>\u4f7f\u7528\u793a\u4f8b<\/strong><\/p>\n\n\n\n<p>\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u914d\u7f6e\u7c7b\uff0c\u7528\u4e8e\u7ed1\u5b9a\u6570\u636e\u5e93\u8fde\u63a5\u7684\u914d\u7f6e\u5c5e\u6027\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>import org.springframework.boot.context.properties.ConfigurationProperties;<\/code><code>import org.springframework.stereotype.Component;<\/code><code><br><\/code><code>@Component<\/code><code>@ConfigurationProperties(prefix = \"database\")<\/code><code>public class DatabaseProperties {<\/code><code> &nbsp; &nbsp;private String url;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;String&nbsp;username;&nbsp;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;String&nbsp;password;<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>&nbsp;   \/\/ Getters and Setters<\/code><code>}<\/code><\/pre>\n\n\n\n<p>\u200d\u5728 application.yml \u4e2d\u914d\u7f6e\u5c5e\u6027\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>database:<\/code><code> &nbsp;url: jdbc:mysql:\/\/localhost:3306\/mydb<\/code><code> &nbsp;username: user<\/code><code>&nbsp;&nbsp;password:&nbsp;secret<\/code><\/pre>\n\n\n\n<p><strong>\u573a\u666f\u4f18\u5316<\/strong><\/p>\n\n\n\n<p>\u8fd9\u79cd\u7c7b\u578b\u5b89\u5168\u7684\u914d\u7f6e\u65b9\u5f0f\u9002\u5408\u4e8e\u9700\u8981\u591a\u4e2a\u914d\u7f6e\u9879\u7684\u5e94\u7528\uff0c\u6bd4\u5982\u5fae\u670d\u52a1\u67b6\u6784\u4e2d\u7684\u670d\u52a1\u914d\u7f6e\u3002\u901a\u8fc7\u4f7f\u7528\u7c7b\u578b\u5b89\u5168\u7684\u914d\u7f6e\u7c7b\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u907f\u514d\u624b\u52a8\u89e3\u6790\u914d\u7f6e\u5c5e\u6027\u5bfc\u81f4\u7684\u9519\u8bef\uff0c\u63d0\u9ad8\u4e86\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u7ef4\u62a4\u6027\u3002<\/p>\n\n\n\n<p><strong>\u573a\u666f\u63cf\u8ff0<\/strong><\/p>\n\n\n\n<p>\u5728\u5fae\u670d\u52a1\u67b6\u6784\u4e2d\uff0c\u591a\u4e2a\u670d\u52a1\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u6570\u636e\u5e93\u3001\u6d88\u606f\u961f\u5217\u7b49\u5171\u4eab\u7684\u8d44\u6e90\u3002\u6bcf\u4e2a\u670d\u52a1\u53ef\u80fd\u9700\u8981\u4e0d\u540c\u7684\u914d\u7f6e\u9879\uff0c\u4f8b\u5982\u6570\u636e\u5e93 URL\u3001\u7528\u6237\u540d\u548c\u5bc6\u7801\u7b49\u3002<\/p>\n\n\n\n<p><strong>\u4f18\u5316\u65b9\u6cd5<\/strong><\/p>\n\n\n\n<p>\u901a\u8fc7\u4f7f\u7528 @ConfigurationProperties\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u670d\u52a1\u521b\u5efa\u72ec\u7acb\u7684\u914d\u7f6e\u7c7b\uff0c\u786e\u4fdd\u7c7b\u578b\u5b89\u5168\u548c\u7ed3\u6784\u5316\u3002\u8fd9\u6837\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u907f\u514d\u624b\u52a8\u89e3\u6790\u914d\u7f6e\uff0c\u51cf\u5c11\u51fa\u9519\u7684\u98ce\u9669\uff0c\u8fd8\u80fd\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n\n\n\n<p>\u5047\u8bbe\u6709\u4e00\u4e2a\u7528\u6237\u670d\u52a1\u548c\u4e00\u4e2a\u8ba2\u5355\u670d\u52a1\uff0c\u5206\u522b\u9700\u8981\u4e0d\u540c\u7684\u6570\u636e\u5e93\u914d\u7f6e\uff1a<\/p>\n\n\n\n<p><strong>\u7528\u6237\u670d\u52a1\u914d\u7f6e\u7c7b\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>import org.springframework.boot.context.properties.ConfigurationProperties;<\/code><code>import org.springframework.stereotype.Component;<\/code><code><br><\/code><code>@Component<\/code><code>@ConfigurationProperties(prefix = \"user-service.database\")<\/code><code>public class UserServiceDatabaseProperties {<\/code><code> &nbsp; &nbsp;private String url;<\/code><code> &nbsp; &nbsp;private String username;<\/code><code> &nbsp; &nbsp;private String password;<\/code><code><br><\/code><code> &nbsp; &nbsp;<em>\/\/ Getters and Setters<\/em><\/code><code>}<\/code><\/pre>\n\n\n\n<p><strong>\u8ba2\u5355\u670d\u52a1\u914d\u7f6e\u7c7b\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>import org.springframework.boot.context.properties.ConfigurationProperties;<\/code><code>import org.springframework.stereotype.Component;<\/code><code><br><\/code><code>@Component<\/code><code>@ConfigurationProperties(prefix = \"order-service.database\")<\/code><code>public class OrderServiceDatabaseProperties {<\/code><code> &nbsp; &nbsp;private String url;<\/code><code> &nbsp; &nbsp;private String username;<\/code><code> &nbsp; &nbsp;private String password;<\/code><code><br><\/code><code> &nbsp; &nbsp;<em>\/\/ Getters and Setters<\/em><\/code><code>}<\/code><\/pre>\n\n\n\n<p><strong>YAML \u914d\u7f6e\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>user-service:<\/code><code> &nbsp;database:<\/code><code> &nbsp; &nbsp;url: jdbc:mysql:\/\/localhost:3306\/users<\/code><code> &nbsp; &nbsp;username: user<\/code><code> &nbsp; &nbsp;password: userpass<\/code><code><br><\/code><code>order-service:<\/code><code> &nbsp;database:<\/code><code> &nbsp; &nbsp;url: jdbc:mysql:\/\/localhost:3306\/orders<\/code><code> &nbsp; &nbsp;username: orderuser<\/code><code>&nbsp;&nbsp;&nbsp;&nbsp;password:&nbsp;orderpass<\/code><\/pre>\n\n\n\n<p><strong>\u7ed3\u679c<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>\u6e05\u6670\u7684\u7ed3\u6784<\/strong>\uff1a\u6bcf\u4e2a\u670d\u52a1\u7684\u914d\u7f6e\u90fd\u660e\u786e\u5206\u5f00\uff0c\u4fbf\u4e8e\u7ba1\u7406\u548c\u7406\u89e3\u3002<\/li><li><strong>\u7c7b\u578b\u5b89\u5168<\/strong>\uff1a\u901a\u8fc7\u5f3a\u7c7b\u578b\u7684\u914d\u7f6e\u7c7b\uff0c\u51cf\u5c11\u4e86\u56e0\u6570\u636e\u7c7b\u578b\u4e0d\u4e00\u81f4\u5bfc\u81f4\u7684\u9519\u8bef\u3002<\/li><\/ul>\n\n\n\n<p><strong>2.2 \u652f\u6301\u591a\u79cd\u914d\u7f6e\u6e90<\/strong><\/p>\n\n\n\n<p><strong>\u8be6\u7ec6\u8bf4\u660e<\/strong><\/p>\n\n\n\n<p>Spring Boot 3.4.0 \u8fdb\u4e00\u6b65\u589e\u5f3a\u4e86\u5bf9\u591a\u79cd\u914d\u7f6e\u6e90\u7684\u652f\u6301\uff0c\u5305\u62ec\u73af\u5883\u53d8\u91cf\u3001\u547d\u4ee4\u884c\u53c2\u6570\u3001\u4ee5\u53ca\u5916\u90e8\u914d\u7f6e\u6587\u4ef6\u7b49\u3002\u5f00\u53d1\u8005\u53ef\u4ee5\u7075\u6d3b\u5730\u4ece\u4e0d\u540c\u7684\u6e90\u4e2d\u8bfb\u53d6\u914d\u7f6e\u3002<\/p>\n\n\n\n<p><strong>\u4f7f\u7528\u793a\u4f8b<\/strong><\/p>\n\n\n\n<p>\u5047\u8bbe\u6211\u4eec\u5e0c\u671b\u4ece\u73af\u5883\u53d8\u91cf\u4e2d\u8bfb\u53d6\u914d\u7f6e\uff0c\u53ef\u4ee5\u5728 application.yml \u4e2d\u4f7f\u7528\u4ee5\u4e0b\u8bbe\u7f6e\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>database:<\/code><code> &nbsp;url: ${DATABASE_URL:jdbc:mysql:\/\/localhost:3306\/defaultdb}<\/code><code> &nbsp;username: ${DATABASE_USERNAME:user}<\/code><code>&nbsp;&nbsp;password:&nbsp;${DATABASE_PASSWORD:secret}<\/code><\/pre>\n\n\n\n<p>\u5728\u8fd9\u91cc\uff0c\u5982\u679c\u73af\u5883\u53d8\u91cf\u4e0d\u5b58\u5728\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u503c\u3002<\/p>\n\n\n\n<p><strong>\u573a\u666f\u4f18\u5316<\/strong><\/p>\n\n\n\n<p>\u5728\u4e91\u539f\u751f\u5e94\u7528\u573a\u666f\u4e2d\uff0c\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u654f\u611f\u4fe1\u606f\uff08\u5982\u6570\u636e\u5e93\u5bc6\u7801\uff09\u662f\u4e00\u4e2a\u6700\u4f73\u5b9e\u8df5\u3002\u901a\u8fc7\u589e\u5f3a\u7684\u914d\u7f6e\u6e90\u652f\u6301\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u66f4\u8f7b\u677e\u5730\u5728\u4e0d\u540c\u73af\u5883\u4e2d\u8fdb\u884c\u914d\u7f6e\u7ba1\u7406\uff0c\u786e\u4fdd\u5e94\u7528\u7684\u7075\u6d3b\u6027\u548c\u5b89\u5168\u6027\u3002<\/p>\n\n\n\n<p><strong>\u573a\u666f\u63cf\u8ff0<\/strong><\/p>\n\n\n\n<p>\u5728\u4e91\u539f\u751f\u5e94\u7528\u4e2d\uff0c\u654f\u611f\u4fe1\u606f\uff08\u5982\u6570\u636e\u5e93\u5bc6\u7801\u3001API \u5bc6\u94a5\uff09\u901a\u5e38\u4e0d\u5e94\u786c\u7f16\u7801\u5728\u6e90\u4ee3\u7801\u4e2d\uff0c\u800c\u5e94\u8be5\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u6216\u5176\u4ed6\u5916\u90e8\u914d\u7f6e\u3002<\/p>\n\n\n\n<p><strong>\u4f18\u5316\u65b9\u6cd5<\/strong><\/p>\n\n\n\n<p>\u5229\u7528 Spring Boot 3.4.0 \u7684\u591a\u79cd\u914d\u7f6e\u6e90\u652f\u6301\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u7075\u6d3b\u5730\u4ece\u73af\u5883\u53d8\u91cf\u3001\u547d\u4ee4\u884c\u53c2\u6570\u6216\u5916\u90e8\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bfb\u53d6\u914d\u7f6e\u3002\u8fd9\u6837\u53ef\u4ee5\u5728\u4e0d\u540c\u7684\u73af\u5883\uff08\u5982\u5f00\u53d1\u3001\u6d4b\u8bd5\u3001\u751f\u4ea7\uff09\u4e2d\u8f7b\u677e\u5207\u6362\u914d\u7f6e\uff0c\u800c\u65e0\u9700\u66f4\u6539\u4ee3\u7801\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n\n\n\n<p><strong>YAML \u914d\u7f6e\u793a\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>database:<\/code><code> &nbsp;url: ${DATABASE_URL:jdbc:mysql:\/\/localhost:3306\/default}<\/code><code> &nbsp;username: ${DATABASE_USERNAME:defaultuser}<\/code><code>&nbsp;&nbsp;password:&nbsp;${DATABASE_PASSWORD:defaultpass}<\/code><\/pre>\n\n\n\n<p>\u5728\u73af\u5883\u4e2d\u8bbe\u7f6e\u76f8\u5e94\u7684\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>export DATABASE_URL=jdbc:mysql:<em>\/\/production-db:3306\/mydb<\/em><\/code><code>export DATABASE_USERNAME=produser<\/code><code>export&nbsp;DATABASE_PASSWORD=prodpass<\/code><\/pre>\n\n\n\n<p><strong>\u7ed3\u679c<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>\u5b89\u5168\u6027\u63d0\u5347<\/strong>\uff1a\u654f\u611f\u4fe1\u606f\u5b58\u653e\u5728\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u964d\u4f4e\u4e86\u6cc4\u9732\u98ce\u9669\u3002<\/li><li><strong>\u7075\u6d3b\u914d\u7f6e<\/strong>\uff1a\u5728\u4e0d\u540c\u73af\u5883\u4e0b\uff0c\u5f00\u53d1\u8005\u53ea\u9700\u66f4\u6539\u73af\u5883\u53d8\u91cf\u5373\u53ef\uff0c\u65e0\u9700\u6539\u52a8\u4ee3\u7801\u3002<\/li><\/ul>\n\n\n\n<p><strong>2.3 \u66f4\u597d\u7684 IDE \u652f\u6301<\/strong><\/p>\n\n\n\n<p><strong>\u8be6\u7ec6\u8bf4\u660e<\/strong><\/p>\n\n\n\n<p>Spring Boot 3.4.0 \u5bf9 IDE \u7684\u652f\u6301\u8fdb\u884c\u4e86\u4f18\u5316\uff0c\u7279\u522b\u662f\u5728\u914d\u7f6e\u6587\u4ef6\u7684\u8865\u5168\u548c\u9a8c\u8bc1\u65b9\u9762\u3002\u8fd9\u4f7f\u5f97\u5f00\u53d1\u8005\u5728\u7f16\u5199\u914d\u7f6e\u65f6\u80fd\u591f\u83b7\u5f97\u5b9e\u65f6\u53cd\u9988\u3002<\/p>\n\n\n\n<p><strong>\u4f7f\u7528\u793a\u4f8b<\/strong><\/p>\n\n\n\n<p>\u5728 IntelliJ IDEA \u4e2d\uff0c\u5f53\u4f60\u7f16\u5199 application.yml \u6216 application.properties \u65f6\uff0cIDE \u4f1a\u6839\u636e @ConfigurationProperties \u6ce8\u89e3\u63d0\u4f9b\u81ea\u52a8\u8865\u5168\u548c\u7c7b\u578b\u63d0\u793a\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u627e\u5230\u9700\u8981\u7684\u914d\u7f6e\u9879\u3002<\/p>\n\n\n\n<p><strong>\u573a\u666f\u4f18\u5316<\/strong><\/p>\n\n\n\n<p>\u5728\u5927\u578b\u9879\u76ee\u4e2d\uff0c\u5f00\u53d1\u8005\u7ecf\u5e38\u9700\u8981\u5904\u7406\u590d\u6742\u7684\u914d\u7f6e\u3002\u589e\u5f3a\u7684 IDE \u652f\u6301\u5927\u5e45\u63d0\u9ad8\u4e86\u5f00\u53d1\u6548\u7387\uff0c\u51cf\u5c11\u4e86\u67e5\u627e\u548c\u9a8c\u8bc1\u914d\u7f6e\u9879\u6240\u9700\u7684\u65f6\u95f4\u3002<\/p>\n\n\n\n<p><strong>\u573a\u666f\u63cf\u8ff0<\/strong><\/p>\n\n\n\n<p>\u5728\u5927\u578b\u9879\u76ee\u4e2d\uff0c\u5f00\u53d1\u8005\u53ef\u80fd\u4f1a\u9891\u7e41\u5730\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\uff0c\u5c24\u5176\u662f\u5728\u5904\u7406\u591a\u4e2a\u914d\u7f6e\u9879\u65f6\uff0c\u5bb9\u6613\u5bfc\u81f4\u9519\u8bef\u6216\u9057\u6f0f\u3002<\/p>\n\n\n\n<p><strong>\u4f18\u5316\u65b9\u6cd5<\/strong><\/p>\n\n\n\n<p>Spring Boot 3.4.0 \u7684 IDE \u652f\u6301\u589e\u5f3a\u4e86\u5bf9\u914d\u7f6e\u6587\u4ef6\u7684\u5b9e\u65f6\u53cd\u9988\uff0c\u5f00\u53d1\u8005\u5728\u7f16\u5199 application.yml \u6216 application.properties \u65f6\uff0c\u53ef\u4ee5\u83b7\u5f97\u81ea\u52a8\u8865\u5168\u548c\u7c7b\u578b\u63d0\u793a\u3002\u8fd9\u4e0d\u4ec5\u63d0\u9ad8\u4e86\u5f00\u53d1\u6548\u7387\uff0c\u8fd8\u51cf\u5c11\u4e86\u914d\u7f6e\u9519\u8bef\u7684\u53ef\u80fd\u6027\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n\n\n\n<p>\u5728 IntelliJ IDEA \u4e2d\uff0c\u5f00\u53d1\u8005\u5728\u7f16\u5199 YAML \u914d\u7f6e\u65f6\uff0cIDE \u4f1a\u6839\u636e @ConfigurationProperties \u63d0\u4f9b\u4e0a\u4e0b\u6587\u63d0\u793a\u3002\u4f8b\u5982\uff0c\u5f53\u8f93\u5165 database. \u65f6\uff0cIDE \u4f1a\u81ea\u52a8\u663e\u793a\u53ef\u7528\u7684\u5c5e\u6027\uff0c\u5982 url\u3001username \u548c password\u3002<\/p>\n\n\n\n<p><strong>\u7ed3\u679c<\/strong><\/p>\n\n\n\n<p>\u5f00\u53d1\u6548\u7387\u63d0\u5347\uff1a\u901a\u8fc7\u5feb\u901f\u7684\u4e0a\u4e0b\u6587\u63d0\u793a\uff0c\u5f00\u53d1\u8005\u80fd\u591f\u66f4\u5feb\u5730\u5b8c\u6210\u914d\u7f6e\u6587\u4ef6\u7684\u7f16\u5199\u3002<\/p>\n\n\n\n<p>\u9519\u8bef\u51cf\u5c11\uff1a\u5b9e\u65f6\u7684\u8bed\u6cd5\u68c0\u67e5\u548c\u63d0\u793a\u5e2e\u52a9\u5f00\u53d1\u8005\u53ca\u65f6\u53d1\u73b0\u548c\u4fee\u590d\u914d\u7f6e\u9519\u8bef\u3002<\/p>\n\n\n\n<p><strong>3. \u9879\u76ee\u4f7f\u7528\u573a\u666f<\/strong><\/p>\n\n\n\n<p><strong>\u9879\u76ee\u6848\u4f8b\uff1a\u5fae\u670d\u52a1\u67b6\u6784<\/strong><\/p>\n\n\n\n<p>\u5728\u4e00\u4e2a\u5fae\u670d\u52a1\u67b6\u6784\u7684\u9879\u76ee\u4e2d\uff0c\u6bcf\u4e2a\u670d\u52a1\u90fd\u6709\u81ea\u5df1\u7684\u914d\u7f6e\u9700\u6c42\u3002\u4f8b\u5982\uff0c\u4e00\u4e2a\u7528\u6237\u670d\u52a1\u53ef\u80fd\u9700\u8981\u6570\u636e\u5e93\u8fde\u63a5\u914d\u7f6e\uff0c\u800c\u4e00\u4e2a\u8ba2\u5355\u670d\u52a1\u53ef\u80fd\u9700\u8981\u4e0d\u540c\u7684\u914d\u7f6e\u3002\u4f7f\u7528 Spring Boot 3.4.0 \u7684\u589e\u5f3a\u914d\u7f6e\u5c5e\u6027\u652f\u6301\uff0c\u5f00\u53d1\u56e2\u961f\u80fd\u591f\u9ad8\u6548\u5730\u7ba1\u7406\u8fd9\u4e9b\u914d\u7f6e\u3002<\/p>\n\n\n\n<p><strong>\u91c7\u7528\u65b0\u7279\u6027\u7684\u597d\u5904<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>\u7c7b\u578b\u5b89\u5168<\/strong>\uff1a\u6bcf\u4e2a\u670d\u52a1\u7684\u914d\u7f6e\u90fd\u4f7f\u7528 @ConfigurationProperties \u7ed1\u5b9a\uff0c\u786e\u4fdd\u914d\u7f6e\u7684\u7c7b\u578b\u5b89\u5168\uff0c\u51cf\u5c11\u4e86\u8fd0\u884c\u65f6\u9519\u8bef\u3002<\/li><li><strong>\u591a\u6e90\u652f\u6301<\/strong>\uff1a\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u548c\u914d\u7f6e\u6587\u4ef6\u7075\u6d3b\u7ba1\u7406\u654f\u611f\u4fe1\u606f\uff0c\u786e\u4fdd\u5728\u4e0d\u540c\u73af\u5883\u4e2d\u914d\u7f6e\u7684\u4e00\u81f4\u6027\u548c\u5b89\u5168\u6027\u3002<\/li><li><strong>IDE \u63d0\u5347<\/strong>\uff1a\u501f\u52a9 IDE \u7684\u667a\u80fd\u63d0\u793a\u548c\u9a8c\u8bc1\u529f\u80fd\uff0c\u5f00\u53d1\u8005\u80fd\u591f\u5feb\u901f\u5b9a\u4f4d\u914d\u7f6e\u95ee\u9898\uff0c\u51cf\u5c11\u4e86\u8c03\u8bd5\u65f6\u95f4\u3002<\/li><\/ul>\n\n\n\n<p><strong>\u7ed3\u679c<\/strong><\/p>\n\n\n\n<p>\u5728\u8fd9\u4e2a\u9879\u76ee\u4e2d\uff0c\u56e2\u961f\u7684\u5f00\u53d1\u6548\u7387\u63d0\u9ad8\u4e86 30%\uff0c\u540c\u65f6\u56e0\u4e3a\u914d\u7f6e\u7ba1\u7406\u7684\u4e0d\u6613\u51fa\u9519\uff0c\u4f7f\u5f97\u7cfb\u7edf\u7684\u7a33\u5b9a\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u4e5f\u5f97\u5230\u4e86\u663e\u8457\u63d0\u5347\u3002<\/p>\n\n\n\n<p><strong>4. \u4e0e 3.3 \u7248\u672c\u7684\u5bf9\u6bd4<\/strong><\/p>\n\n\n\n<p>\u5728 Spring Boot 3.3 \u7248\u672c\u4e2d\uff0c\u867d\u7136\u5df2\u7ecf\u652f\u6301\u57fa\u672c\u7684\u914d\u7f6e\u5c5e\u6027\u7ed1\u5b9a\uff0c\u4f46\u5728\u7c7b\u578b\u5b89\u5168\u3001\u914d\u7f6e\u6e90\u652f\u6301\u548c IDE \u4f53\u9a8c\u7b49\u65b9\u9762\u5b58\u5728\u4e00\u4e9b\u4e0d\u8db3\u3002\u4ee5\u4e0b\u662f\u4e24\u4e2a\u7248\u672c\u4e4b\u95f4\u7684\u4e3b\u8981\u533a\u522b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>\u7279\u6027<\/strong><\/td><td><strong>Spring Boot 3.3<\/strong><\/td><td><strong>Spring Boot 3.4.0<\/strong><\/td><\/tr><tr><td>\u7c7b\u578b\u5b89\u5168\u914d\u7f6e<\/td><td>\u652f\u6301\u57fa\u672c\u7684\u914d\u7f6e\u5c5e\u6027\u7ed1\u5b9a<\/td><td>\u589e\u5f3a\u4e86\u7c7b\u578b\u5b89\u5168\u548c\u9a8c\u8bc1<\/td><\/tr><tr><td>\u591a\u79cd\u914d\u7f6e\u6e90\u652f\u6301<\/td><td>\u652f\u6301\u57fa\u672c\u7684\u914d\u7f6e\u6e90<\/td><td>\u7edf\u4e00\u652f\u6301\u73af\u5883\u53d8\u91cf\u3001\u547d\u4ee4\u884c\u53c2\u6570\u7b49\uff0c\u7075\u6d3b\u6027\u66f4\u9ad8<\/td><\/tr><tr><td>IDE \u652f\u6301<\/td><td>\u81ea\u52a8\u8865\u5168\u548c\u9a8c\u8bc1\u6709\u9650<\/td><td>\u6539\u8fdb\u4e86 IDE \u7684\u8865\u5168\u548c\u9a8c\u8bc1\u4f53\u9a8c<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>5. \u7ed3\u8bba<\/strong><\/p>\n\n\n\n<p>Spring Boot 3.4.0 \u5728\u914d\u7f6e\u5c5e\u6027\u652f\u6301\u65b9\u9762\u7684\u589e\u5f3a\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u66f4\u5f3a\u5927\u548c\u7075\u6d3b\u7684\u5de5\u5177\uff0c\u4f7f\u5f97\u914d\u7f6e\u7ba1\u7406\u66f4\u52a0\u9ad8\u6548\u548c\u5b89\u5168\u3002\u901a\u8fc7\u7c7b\u578b\u5b89\u5168\u914d\u7f6e\u3001\u591a\u79cd\u914d\u7f6e\u6e90\u652f\u6301\u548c\u66f4\u597d\u7684 IDE \u652f\u6301\uff0c\u5f00\u53d1\u8005\u80fd\u591f\u66f4\u8f7b\u677e\u5730\u7ba1\u7406\u5e94\u7528\u7684\u914d\u7f6e\uff0c\u51cf\u5c11\u9519\u8bef\uff0c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002\u5efa\u8bae\u5f00\u53d1\u8005\u5728\u9879\u76ee\u4e2d\u5145\u5206\u5229\u7528\u8fd9\u4e9b\u65b0\u7279\u6027\uff0c\u4ee5\u63d0\u5347\u4ee3\u7801\u8d28\u91cf\u548c\u53ef\u7ef4\u62a4\u6027\u3002\u2014END\u2014<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>\u6700\u65b0<\/strong>\u6574\u7406\uff1a\ud83d\udd13CSDN\u4f1a\u5458\u514d\u8d39\u7535\u5b50\u4e661000\u672c\u3001\ud83d\udda5\u9ed1\u5ba2\u6280\u672f\u5b66\u4e60\u4e66\u7c4d\u5927\u5408\u96c6\u3001\ud83d\udcbb\u8ba1\u7b97\u673a\u6280\u672f\u4e13\u9898\u4e66\u7c4d\u301069GB\u3011\u300160\u591a\u95e8\u7f16\u7a0b\u8bed\u8a00\u5b66\u4e60\u4e66\u7c4d\u8d85\u7ea7\u5927\u5408\u96c6\uff08700+\u672cPDF\uff09\u3001\ud83d\udda5\u8ba1\u7b97\u673a\u4e8c\u7ea7\u4e13\u9898\u3010183GB\u3011\u7b49\u7f16\u7a0b\u5408\u96c6\uff01<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_gif\/a7wPU9Eqe9tS7sQhiacpoIcAjwaYRpePoqQCD5AgBPrIdhH5KSRe9qnDvVicBGLwnYJzrFbsxLPFaEaFgRicYTlIg\/640?wx_fmt=gif&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1&amp;tp=wxpic\" alt=\"\u56fe\u7247\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8d44\u6e90\uff0c\u600e\u4e48\u9886\u53d6\uff1f<\/strong><br>\u626b\u4e8c\u7ef4\u7801\uff0c\u52a0\u6211\u5fae\u4fe1\uff0c\u5907\u6ce8\uff1a<strong>\u7f16\u7a0b\u5408\u96c6<\/strong><br>\u4e00\u5b9a\u8981\u5907\u6ce8\uff1a<strong>\u7f16\u7a0b\u5408\u96c6<\/strong>\uff0c\u4e0d\u8981\u6025\u54e6\uff0c\u5de5\u4f5c\u5fd9\u5b8c\u540e\u5c31\u4f1a\u901a\u8fc7\uff01<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Spring Boot 3.4.0 \u7248\u672c\u5728\u914d\u7f6e\u5c5e\u6027\u7684\u652f\u6301\u4e0a\u8fdb\u884c\u4e86\u663e\u8457\u589e\u5f3a\uff0c\u4f7f\u5f97\u5f00\u53d1\u8005\u80fd\u591f\u66f4\u7075\u6d3b\u5730\u7ba1\u7406\u548c\u4f7f\u7528\u5e94\u7528 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/cxycd.cn\/index.php\/wp-json\/wp\/v2\/posts\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/cxycd.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/cxycd.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/cxycd.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/cxycd.cn\/index.php\/wp-json\/wp\/v2\/comments?post=8"}],"version-history":[{"count":1,"href":"http:\/\/cxycd.cn\/index.php\/wp-json\/wp\/v2\/posts\/8\/revisions"}],"predecessor-version":[{"id":9,"href":"http:\/\/cxycd.cn\/index.php\/wp-json\/wp\/v2\/posts\/8\/revisions\/9"}],"wp:attachment":[{"href":"http:\/\/cxycd.cn\/index.php\/wp-json\/wp\/v2\/media?parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/cxycd.cn\/index.php\/wp-json\/wp\/v2\/categories?post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/cxycd.cn\/index.php\/wp-json\/wp\/v2\/tags?post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}