{"id":457195,"date":"2025-04-24T09:00:52","date_gmt":"2025-04-24T09:00:52","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=457195"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2025-04-24T09:00:52","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=457195","title":{"rendered":"<span>Spring Boot: \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 CLI \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spring Shell<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/t.me\/+QmrKn0wA8CdkNjAy\"><u>Spring \u0410\u0439\u041e<\/u><\/a> \u043f\u0435\u0440\u0435\u0432\u0435\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044e \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438\u00a0 \u0432 Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u0421\u0442\u0430\u0442\u044c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0432 \u0444\u043e\u0440\u043c\u0435 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0448\u0430\u0433\u0438 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0441\u0432\u043e\u0435\u043d\u0438\u044f Spring Shell.<\/p>\n<hr\/>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b0d\/bac\/af3\/b0dbacaf376ed3f9715914884bfa3360.jpeg\" width=\"816\" height=\"543\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/b0d\/bac\/af3\/b0dbacaf376ed3f9715914884bfa3360.jpeg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b0d\/bac\/af3\/b0dbacaf376ed3f9715914884bfa3360.jpeg 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0412\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 (Command Line Interface, CLI) \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u043d\u0430\u0432\u043e\u0440\u043e\u0447\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0431 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441? Spring Shell \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u043d\u0430 \u0432\u0430\u0448 \u0432\u043e\u043f\u0440\u043e\u0441. \u0418\u0437 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 CLI. \u041f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f!<\/p>\n<h3>1. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041d\u0435 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f GUI, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0439 \u043e\u0442\u043a\u043b\u0438\u043a\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0432\u0441\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0418\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438 Spring \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442<a href=\"https:\/\/docs.spring.io\/spring-shell\/reference\/index.html\"> <u>Spring Shell<\/u><\/a>. \u041a\u0430\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b Spring, Spring Shell \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0430\u0441 \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043a\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>help<\/code>, <code>clear<\/code>, <code>exit<\/code> \u0438 \u0442.\u0434. \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438, \u043a\u0430\u043a \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 Tab. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0438 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u0430\u043a \u0432\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0431\u044b \u044d\u0442\u043e \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f GraalVM!<\/p>\n<p>\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u0432\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439: \u0441\u0442\u0430\u0440\u0430\u044f (legacy) \u043c\u043e\u0434\u0435\u043b\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 (\u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0430\u044f\u0441\u044f \u043a <code>@ShellMethod<\/code> \u0438 <code>@ShellOption<\/code>) \u0438 \u043d\u043e\u0432\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0441\u0442\u0430\u0440\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/spring-projects\/spring-shell\/tree\/main\/spring-shell-samples\/spring-shell-sample-commands\"><u>Spring Shell git repository<\/u><\/a>.<\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 <a href=\"https:\/\/github.com\/mydeveloperplanet\/myspringshellplanet\"><u>GitHub<\/u><\/a>.<\/p>\n<h3>2. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f<\/h3>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u043e Java;<\/p>\n<\/li>\n<li>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u043e Maven;<\/p>\n<\/li>\n<li>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u043e Spring Boot.<\/p>\n<\/li>\n<\/ul>\n<h3>3. \u041c\u043e\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 Shell<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043d\u0430 \u0441\u0430\u0439\u0442 <a href=\"https:\/\/start.spring.io\/\"><u>Spring Initializr<\/u><\/a> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c <strong>Spring Shell<\/strong>. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 pom \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<pre><code class=\"xml\">&lt;dependencies&gt;     &lt;dependency&gt;         &lt;groupId&gt;org.springframework.shell&lt;\/groupId&gt;         &lt;artifactId&gt;spring-shell-starter&lt;\/artifactId&gt;     &lt;\/dependency&gt;       &lt;dependency&gt;         &lt;groupId&gt;org.springframework.shell&lt;\/groupId&gt;         &lt;artifactId&gt;spring-shell-starter-test&lt;\/artifactId&gt;         &lt;scope&gt;test&lt;\/scope&gt;     &lt;\/dependency&gt; &lt;\/dependencies&gt;   &lt;dependencyManagement&gt;     &lt;dependencies&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.springframework.shell&lt;\/groupId&gt;             &lt;artifactId&gt;spring-shell-dependencies&lt;\/artifactId&gt;             &lt;version&gt;${spring-shell.version}&lt;\/version&gt;             &lt;type&gt;pom&lt;\/type&gt;             &lt;scope&gt;import&lt;\/scope&gt;         &lt;\/dependency&gt;     &lt;\/dependencies&gt; &lt;\/dependencyManagement&gt;<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043a\u043b\u0430\u0441\u0441 <code>HelloWorld<\/code> \u0441 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>hello-world<\/code>. \u041d\u0430 \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@Command<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u043e\u043c\u0435\u0447\u0435\u043d <code>@Command<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Spring Shell \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043c\u0435\u043d\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>command<\/code> \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@Command<\/code> \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u041e\u0442\u043c\u0435\u0442\u044c\u0442\u0435 \u0434\u043b\u044f \u0441\u0435\u0431\u044f, \u0447\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0434\u0432\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u0438\u043c\u0435\u043d\u0435\u043c, \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e, \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>description<\/code>. \u041e\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u0443\u043a\u0432\u044b \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u0447\u043a\u043e\u0439, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f best practice.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"java\">@Command public class HelloWorld {       @Command(description = \"This command will say hello.\")     public String helloWorld() {         return \"Hello World!\";     }   }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c Spring, \u0447\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <code>MySpringShellPlanetApplication<\/code>. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435:<\/p>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@EnableCommand<\/code> \u0438 \u0437\u0430\u0434\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u043b\u0430\u0441\u0441\u044b \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430);<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@CommandScan<\/code>, \u0447\u0442\u043e\u0431\u044b Spring \u043e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u0432\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u044b.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"java\">@SpringBootApplication \/\/@EnableCommand(HelloWorld.class) @CommandScan public class MySpringShellPlanetApplication {       public static void main(String[] args) {         SpringApplication.run(MySpringShellPlanetApplication.class, args);     }   }<\/code><\/pre>\n<p>Spring Shell \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c, \u0438 \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0432 <code>application.properties<\/code>. <\/p>\n<pre><code>spring.shell.interactive.enabled=true<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Maven \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 <code>-DskipTests<\/code>, \u0438\u043d\u0430\u0447\u0435 \u0442\u0435\u0441\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0436\u0434\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0438 \u0441\u0431\u043e\u0440\u043a\u0430 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f. \u0412 \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0439\u0441\u044f \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c <strong>\u043d\u0435<\/strong> \u0432\u043a\u043b\u044e\u0447\u0435\u043d.\u00a0<\/p>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"bash\">mvn clean verify<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 Java \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 <code>hello-world<\/code>. <\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar hello-world     .   ____          _            __ _ _  \/\\\\ \/ ___'_ __ _ _(_)_ __  __ _ \\ \\ \\ \\ ( ( )\\___ | '_ | '_| | '_ \\\/ _` | \\ \\ \\ \\  \\\\\/  ___)| |_)| | | | | || (_| |  ) ) ) )   '  |____| .__|_| |_|_| |_\\__, | \/ \/ \/ \/  =========|_|==============|___\/=\/_\/_\/_\/    :: Spring Boot ::                (v3.3.5)   2024-11-10T09:48:04.050+01:00  INFO 10688 --- [MySpringShellPlanet] [           main] c.m.m.MySpringShellPlanetApplication     : Starting MySpringShellPlanetApplication v0.0.1-SNAPSHOT using Java 21 with PID 10688 (\/home\/&lt;project directory&gt;\/myspringshellplanet\/target\/myspringshellplanet-0.0.1-SNAPSHOT.jar started by &lt;user&gt; in \/home\/&lt;project directory&gt;\/myspringshellplanet) 2024-11-10T09:48:04.053+01:00  INFO 10688 --- [MySpringShellPlanet] [           main] c.m.m.MySpringShellPlanetApplication     : No active profile set, falling back to 1 default profile: \"default\" 2024-11-10T09:48:04.761+01:00  INFO 10688 --- [MySpringShellPlanet] [           main] c.m.m.MySpringShellPlanetApplication     : Started MySpringShellPlanetApplication in 0.952 seconds (process running for 1.215) Hello World!<\/code><\/pre>\n<p>\u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e, \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u043b\u043e\u0441\u044c. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0431\u0430\u043d\u043d\u0435\u0440 Spring Boot \u0438 \u043b\u043e\u0433.<\/p>\n<p>\u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0431\u0430\u043d\u043d\u0435\u0440 \u0438 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 <code>application.properties<\/code>.<\/p>\n<pre><code>spring.main.banner-mode=off logging.pattern.console=<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437. \u0415\u0433\u043e \u0432\u044b\u0432\u043e\u0434 \u0442\u0435\u043f\u0435\u0440\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u0432\u044b\u0432\u043e\u0434 shell-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar hello-world Hello World!<\/code><\/pre>\n<h3>4. \u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/h3>\n<p>Spring Shell \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e <a href=\"https:\/\/docs.spring.io\/spring-shell\/reference\/commands\/builtin\/index.html\"><u>\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434<\/u><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>help<\/code>. \u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>hello-world<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0440\u0430\u043d\u0435\u0435.<\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar help AVAILABLE COMMANDS   Built-In Commands        help: Display help about available commands        history: Display or save the history of previously run commands        version: Show version info        script: Read and execute commands from a file.   Default        hello-world: This command will say hello.<\/code><\/pre>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <code>history<\/code> \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0443\u044e \u0432\u0430\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar history [help, version, exit, help, exit]<\/code><\/pre>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <code>version<\/code> \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u0441\u0431\u043e\u0440\u043a\u0435 \u0438 git, \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0435\u0441\u0442\u044c. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0446\u0435\u043b\u044c <code>build-info<\/code> \u043a <code>spring-boot-maven-plugin<\/code> \u0432 pom. <\/p>\n<pre><code class=\"xml\">&lt;build&gt;   &lt;plugins&gt;     &lt;plugin&gt;       &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;       &lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;       &lt;executions&gt;         &lt;execution&gt;           &lt;goals&gt;             &lt;goal&gt;build-info&lt;\/goal&gt;           &lt;\/goals&gt;         &lt;\/execution&gt;       &lt;\/executions&gt;     &lt;\/plugin&gt;   &lt;\/plugins&gt;   ... &lt;\/build&gt;<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u043a\u0430\u0436\u0438\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0432\u0435\u0440\u0441\u0438\u0438.  <\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar version Build Version: 0.0.1-SNAPSHOT<\/code><\/pre>\n<h3>5. \u0413\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/h3>\n<p>\u0412 \u0432\u044b\u0432\u043e\u0434\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>help<\/code> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>hello-world<\/code> \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 <strong>Default<\/strong>. Spring Shell \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>group<\/code>.<\/p>\n<pre><code class=\"java\">@Command(group = \"Group Commands\") public class GroupCommands {       @Command()     public String helloWorldGroup() {         return \"Hello World Group!\";     }   }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u043e\u043a\u0430\u0436\u0438\u0442\u0435 help \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>hello-world-group<\/code>. <\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar help AVAILABLE COMMANDS   Built-In Commands        help: Display help about available commands        history: Display or save the history of previously run commands        version: Show version info        script: Read and execute commands from a file.   Default        hello-world: This command will say hello.   Group Commands        hello-world-group:   $ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar hello-world-group Hello World Group!<\/code><\/pre>\n<h3>6. \u041e\u043f\u0446\u0438\u0438<\/h3>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0435\u043a\u0441\u0442. \u041d\u043e \u0432\u0430\u043c \u0447\u0430\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c <strong>Hello World<\/strong>, \u0432\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <strong>name<\/strong>.<\/p>\n<pre><code class=\"java\">@Command(group = \"Options\") public class Options {       @Command     public String helloName(String name) {         return \"Hello \" + name + \"!\";     } }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>hello-name<\/code> \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0438 \u0431\u0435\u0437.  <\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar hello-name Gunter Hello Gunter! $ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar hello-name Missing mandatory option '--name'<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u043f\u0446\u0438\u0438 \u0415\u0441\u043b\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u0432\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0435 \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@Option<\/code>. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043a <code>@Option<\/code> (\u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>hello-name-default<\/code>) \u0438\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043b\u043e\u0433\u0438\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 (\u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>hello-name-option<\/code>). <\/p>\n<pre><code class=\"java\">@Command public String helloNameDefault(@Option(defaultValue = \"World\") String name) {     return \"Hello \" + name + \"!\"; }   @Command public String helloNameOption(@Option String name) {     if (name == null) {         return askForName();     }       return \"Hello \" + name + \"!\"; }   private String askForName() {     System.out.print(\"Please enter a name: \");     return helloNameOption(System.console().readLine()); }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043e\u0431\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. <\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar hello-name-default Hello World! $ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar hello-name-option Please enter a name: Gunter Hello Gunter!<\/code><\/pre>\n<h3>7. \u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f<\/h3>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u0430\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c. \u041f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c <a href=\"https:\/\/mydeveloperplanet.com\/2024\/04\/17\/validation-with-spring-boot\/\"><u>Jakarta Bean Validation API<\/u><\/a>, \u043a\u0430\u043a \u0432\u044b \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 Spring Boot. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <strong>name<\/strong> \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043c\u0435\u0436\u0434\u0443 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. <\/p>\n<pre><code class=\"java\">@Command(group = \"Validation\") public class Validation {       @Command     public String validateName(@Size(min = 2, max = 40, message = \"Name must be between 2 and 40 characters long\") String name) {         return \"Hello \" + name + \"!\";     }   }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>validate-name<\/code>. <\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar validate-name G The following constraints were not met: ConstraintViolationImpl{interpolatedMessage='Name must be between 2 and 40 characters long', propertyPath=validateName.name, rootBeanClass=class com.mydeveloperplanet.myspringshellplanet.examples.Validation, messageTemplate='Name must be between 2 and 40 characters long'}<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043b\u043e\u0445\u043e\u0439 user experience. \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c <code>CustomExceptionResolver<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 <code>CommandExceptionHandler<\/code>. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u0432\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@Order<\/code>, \u0438\u043d\u0430\u0447\u0435 \u0432\u0430\u0448 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 resolver \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0441\u044f. <\/p>\n<pre><code class=\"java\">@Order(0) public class CustomExceptionResolver implements CommandExceptionResolver {       @Override     public CommandHandlingResult resolve(Exception ex) {         if (ex instanceof ParameterValidationException pve) {             return handleConstraintViolation((pve));         }         return null; \/\/ Let other exception handlers deal with other types of exceptions     }       private CommandHandlingResult handleConstraintViolation(ParameterValidationException pve) {         StringBuilder errorMessage = new StringBuilder(\"Validation error(s):\\n\");         for (ConstraintViolation&lt;?&gt; violation : pve.getConstraintViolations()) {             errorMessage.append(\"- \")                         .append(violation.getMessage())                         .append(\"\\n\");         }         return CommandHandlingResult.of(errorMessage.toString());     } }<\/code><\/pre>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0435 <code>CustomExceptionResolver<\/code> \u043a\u0430\u043a \u0431\u0438\u043d \u0432 <code>MySpringShellPlanetApplication<\/code>. <\/p>\n<pre><code class=\"java\">@Bean CustomExceptionResolver customExceptionResolver() {     return new CustomExceptionResolver(); }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>validate-name<\/code>. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435.  <\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar validate-name G Validation error(s): - Name must be between 2 and 40 characters long<\/code><\/pre>\n<h3>8. \u0421\u0431\u043e\u0440\u043a\u0430 \u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437<\/h3>\n<p>\u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u043b\u0438 shell \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 Java. \u041d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u0435\u0441\u043b\u0438 \u0431\u044b \u043e\u043d\u043e \u043d\u0430\u0448 CLI \u0441\u0442\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c \u0444\u0430\u0439\u043b\u043e\u043c. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/docs.spring.io\/spring-shell\/reference\/building.html\"><u>GraalVM<\/u><\/a>.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a pom.<\/p>\n<pre><code class=\"xml\">&lt;build&gt;     &lt;pluginManagement&gt;         &lt;plugins&gt;             &lt;plugin&gt;                 &lt;groupId&gt;org.graalvm.buildtools&lt;\/groupId&gt;                 &lt;artifactId&gt;native-maven-plugin&lt;\/artifactId&gt;                 &lt;configuration&gt;                     &lt;metadataRepository&gt;                         &lt;enabled&gt;true&lt;\/enabled&gt;                     &lt;\/metadataRepository&gt;                 &lt;\/configuration&gt;             &lt;\/plugin&gt;         &lt;\/plugins&gt;     &lt;\/pluginManagement&gt; &lt;\/build&gt;<\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 GraalVM \u0434\u043b\u044f Java 21. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"https:\/\/mydeveloperplanet.com\/2022\/04\/05\/how-to-manage-your-jdks-with-sdkman\/\"><u>SDKMan<\/u><\/a>. \u041a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0438\u0436\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442 GraalVM JDK, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441\u0434\u0435\u043b\u0430\u044e\u0442 \u0435\u0433\u043e JDK \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. <\/p>\n<pre><code class=\"bash\">$ sdk install java 21.0.2-graalce $ sdk use java 21.0.2-graalce<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u043e\u0431\u0440\u0430\u0437 GraalVM. <\/p>\n<pre><code class=\"bash\">$ mvn native:compile -Pnative ... Produced artifacts:  \/home\/&lt;project directory&gt;\/myspringshellplanet\/target\/myspringshellplanet (executable) ======================================================================================================================== Finished generating 'myspringshellplanet' in 1m 26s. [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time:  01:33 min [INFO] Finished at: 2024-11-10T14:42:28+01:00 [INFO] ------------------------------------------------------------------------<\/code><\/pre>\n<p>\u041e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b. \u041e\u043d \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442! <\/p>\n<pre><code class=\"bash\">$ .\/target\/myspringshellplanet hello-name Gunter Hello Gunter!<\/code><\/pre>\n<h3>9. \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>Spring Shell \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f CLI. \u0418 \u0434\u0430, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0441\u0430\u043c\u0438 \u0432 \u0447\u0438\u0441\u0442\u043e\u0439 Java, \u043d\u043e \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438, \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 Spring Shell, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u0432\u0430\u043c \u043a\u0443\u0447\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<hr\/>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/258\/484\/92d\/25848492d4cd2dcd1df595e475569a9a.png\" width=\"1560\" height=\"334\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/258\/484\/92d\/25848492d4cd2dcd1df595e475569a9a.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/258\/484\/92d\/25848492d4cd2dcd1df595e475569a9a.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u043a\u00a0\u0440\u0443\u0441\u0441\u043a\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u043c\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0430\u00a0Spring Boot \u0432\u00a0\u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u00a0\u2014 <a href=\"https:\/\/t.me\/+oBwACbkvJ19iODAy\">Spring \u0410\u0439\u041e<\/a>, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0432 \u043a\u0443\u0440\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u043d\u043e\u0432\u043e\u0441\u0442\u0435\u0439 \u0438\u0437 \u043c\u0438\u0440\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 Spring Boot \u0438 \u0432\u0441\u0435\u0433\u043e, \u0447\u0442\u043e \u0441 \u043d\u0438\u043c \u0441\u0432\u044f\u0437\u0430\u043d\u043e.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/903864\/\"> https:\/\/habr.com\/ru\/articles\/903864\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/t.me\/+QmrKn0wA8CdkNjAy\"><u>Spring \u0410\u0439\u041e<\/u><\/a> \u043f\u0435\u0440\u0435\u0432\u0435\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044e \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438\u00a0 \u0432 Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u0421\u0442\u0430\u0442\u044c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0432 \u0444\u043e\u0440\u043c\u0435 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0448\u0430\u0433\u0438 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0441\u0432\u043e\u0435\u043d\u0438\u044f Spring Shell.<\/p>\n<hr\/>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 (Command Line Interface, CLI) \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u043d\u0430\u0432\u043e\u0440\u043e\u0447\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0431 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441? Spring Shell \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u043d\u0430 \u0432\u0430\u0448 \u0432\u043e\u043f\u0440\u043e\u0441. \u0418\u0437 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 CLI. \u041f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f!<\/p>\n<h3>1. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041d\u0435 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f GUI, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0439 \u043e\u0442\u043a\u043b\u0438\u043a\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0432\u0441\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0418\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438 Spring \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442<a href=\"https:\/\/docs.spring.io\/spring-shell\/reference\/index.html\"> <u>Spring Shell<\/u><\/a>. \u041a\u0430\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b Spring, Spring Shell \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0430\u0441 \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043a\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>help<\/code>, <code>clear<\/code>, <code>exit<\/code> \u0438 \u0442.\u0434. \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438, \u043a\u0430\u043a \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 Tab. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0438 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u0430\u043a \u0432\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0431\u044b \u044d\u0442\u043e \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f GraalVM!<\/p>\n<p>\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u0432\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439: \u0441\u0442\u0430\u0440\u0430\u044f (legacy) \u043c\u043e\u0434\u0435\u043b\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 (\u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0430\u044f\u0441\u044f \u043a <code>@ShellMethod<\/code> \u0438 <code>@ShellOption<\/code>) \u0438 \u043d\u043e\u0432\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0441\u0442\u0430\u0440\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/spring-projects\/spring-shell\/tree\/main\/spring-shell-samples\/spring-shell-sample-commands\"><u>Spring Shell git repository<\/u><\/a>.<\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 <a href=\"https:\/\/github.com\/mydeveloperplanet\/myspringshellplanet\"><u>GitHub<\/u><\/a>.<\/p>\n<h3>2. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f<\/h3>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u043e Java;<\/p>\n<\/li>\n<li>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u043e Maven;<\/p>\n<\/li>\n<li>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u043e Spring Boot.<\/p>\n<\/li>\n<\/ul>\n<h3>3. \u041c\u043e\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 Shell<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043d\u0430 \u0441\u0430\u0439\u0442 <a href=\"https:\/\/start.spring.io\/\"><u>Spring Initializr<\/u><\/a> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c <strong>Spring Shell<\/strong>. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 pom \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<pre><code class=\"xml\">&lt;dependencies&gt;     &lt;dependency&gt;         &lt;groupId&gt;org.springframework.shell&lt;\/groupId&gt;         &lt;artifactId&gt;spring-shell-starter&lt;\/artifactId&gt;     &lt;\/dependency&gt;       &lt;dependency&gt;         &lt;groupId&gt;org.springframework.shell&lt;\/groupId&gt;         &lt;artifactId&gt;spring-shell-starter-test&lt;\/artifactId&gt;         &lt;scope&gt;test&lt;\/scope&gt;     &lt;\/dependency&gt; &lt;\/dependencies&gt;   &lt;dependencyManagement&gt;     &lt;dependencies&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.springframework.shell&lt;\/groupId&gt;             &lt;artifactId&gt;spring-shell-dependencies&lt;\/artifactId&gt;             &lt;version&gt;${spring-shell.version}&lt;\/version&gt;             &lt;type&gt;pom&lt;\/type&gt;             &lt;scope&gt;import&lt;\/scope&gt;         &lt;\/dependency&gt;     &lt;\/dependencies&gt; &lt;\/dependencyManagement&gt;<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043a\u043b\u0430\u0441\u0441 <code>HelloWorld<\/code> \u0441 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>hello-world<\/code>. \u041d\u0430 \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@Command<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u043e\u043c\u0435\u0447\u0435\u043d <code>@Command<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Spring Shell \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043c\u0435\u043d\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>command<\/code> \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@Command<\/code> \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u041e\u0442\u043c\u0435\u0442\u044c\u0442\u0435 \u0434\u043b\u044f \u0441\u0435\u0431\u044f, \u0447\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0434\u0432\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u0438\u043c\u0435\u043d\u0435\u043c, \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e, \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>description<\/code>. \u041e\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u0443\u043a\u0432\u044b \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u0447\u043a\u043e\u0439, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f best practice.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"java\">@Command public class HelloWorld {       @Command(description = \"This command will say hello.\")     public String helloWorld() {         return \"Hello World!\";     }   }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c Spring, \u0447\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <code>MySpringShellPlanetApplication<\/code>. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435:<\/p>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@EnableCommand<\/code> \u0438 \u0437\u0430\u0434\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u043b\u0430\u0441\u0441\u044b \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430);<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@CommandScan<\/code>, \u0447\u0442\u043e\u0431\u044b Spring \u043e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u0432\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u044b.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"java\">@SpringBootApplication \/\/@EnableCommand(HelloWorld.class) @CommandScan public class MySpringShellPlanetApplication {       public static void main(String[] args) {         SpringApplication.run(MySpringShellPlanetApplication.class, args);     }   }<\/code><\/pre>\n<p>Spring Shell \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c, \u0438 \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0432 <code>application.properties<\/code>. <\/p>\n<pre><code>spring.shell.interactive.enabled=true<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Maven \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 <code>-DskipTests<\/code>, \u0438\u043d\u0430\u0447\u0435 \u0442\u0435\u0441\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0436\u0434\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0438 \u0441\u0431\u043e\u0440\u043a\u0430 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f. \u0412 \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0439\u0441\u044f \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c <strong>\u043d\u0435<\/strong> \u0432\u043a\u043b\u044e\u0447\u0435\u043d.\u00a0<\/p>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"bash\">mvn clean verify<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 Java \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 <code>hello-world<\/code>. <\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar hello-world     .   ____          _            __ _ _  \/\\\\ \/ ___'_ __ _ _(_)_ __  __ _ \\ \\ \\ \\ ( ( )\\___ | '_ | '_| | '_ \\\/ _` | \\ \\ \\ \\  \\\\\/  ___)| |_)| | | | | || (_| |  ) ) ) )   '  |____| .__|_| |_|_| |_\\__, | \/ \/ \/ \/  =========|_|==============|___\/=\/_\/_\/_\/    :: Spring Boot ::                (v3.3.5)   2024-11-10T09:48:04.050+01:00  INFO 10688 --- [MySpringShellPlanet] [           main] c.m.m.MySpringShellPlanetApplication     : Starting MySpringShellPlanetApplication v0.0.1-SNAPSHOT using Java 21 with PID 10688 (\/home\/&lt;project directory&gt;\/myspringshellplanet\/target\/myspringshellplanet-0.0.1-SNAPSHOT.jar started by &lt;user&gt; in \/home\/&lt;project directory&gt;\/myspringshellplanet) 2024-11-10T09:48:04.053+01:00  INFO 10688 --- [MySpringShellPlanet] [           main] c.m.m.MySpringShellPlanetApplication     : No active profile set, falling back to 1 default profile: \"default\" 2024-11-10T09:48:04.761+01:00  INFO 10688 --- [MySpringShellPlanet] [           main] c.m.m.MySpringShellPlanetApplication     : Started MySpringShellPlanetApplication in 0.952 seconds (process running for 1.215) Hello World!<\/code><\/pre>\n<p>\u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e, \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u043b\u043e\u0441\u044c. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0431\u0430\u043d\u043d\u0435\u0440 Spring Boot \u0438 \u043b\u043e\u0433.<\/p>\n<p>\u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0431\u0430\u043d\u043d\u0435\u0440 \u0438 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 <code>application.properties<\/code>.<\/p>\n<pre><code>spring.main.banner-mode=off logging.pattern.console=<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437. \u0415\u0433\u043e \u0432\u044b\u0432\u043e\u0434 \u0442\u0435\u043f\u0435\u0440\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u0432\u044b\u0432\u043e\u0434 shell-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar hello-world Hello World!<\/code><\/pre>\n<h3>4. \u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/h3>\n<p>Spring Shell \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e <a href=\"https:\/\/docs.spring.io\/spring-shell\/reference\/commands\/builtin\/index.html\"><u>\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434<\/u><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>help<\/code>. \u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>hello-world<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0440\u0430\u043d\u0435\u0435.<\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar help AVAILABLE COMMANDS   Built-In Commands        help: Display help about available commands        history: Display or save the history of previously run commands        version: Show version info        script: Read and execute commands from a file.   Default        hello-world: This command will say hello.<\/code><\/pre>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <code>history<\/code> \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0443\u044e \u0432\u0430\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar history [help, version, exit, help, exit]<\/code><\/pre>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <code>version<\/code> \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u0441\u0431\u043e\u0440\u043a\u0435 \u0438 git, \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0435\u0441\u0442\u044c. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0446\u0435\u043b\u044c <code>build-info<\/code> \u043a <code>spring-boot-maven-plugin<\/code> \u0432 pom. <\/p>\n<pre><code class=\"xml\">&lt;build&gt;   &lt;plugins&gt;     &lt;plugin&gt;       &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;       &lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;       &lt;executions&gt;         &lt;execution&gt;           &lt;goals&gt;             &lt;goal&gt;build-info&lt;\/goal&gt;           &lt;\/goals&gt;         &lt;\/execution&gt;       &lt;\/executions&gt;     &lt;\/plugin&gt;   &lt;\/plugins&gt;   ... &lt;\/build&gt;<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u043a\u0430\u0436\u0438\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0432\u0435\u0440\u0441\u0438\u0438.  <\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar version Build Version: 0.0.1-SNAPSHOT<\/code><\/pre>\n<h3>5. \u0413\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/h3>\n<p>\u0412 \u0432\u044b\u0432\u043e\u0434\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>help<\/code> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>hello-world<\/code> \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 <strong>Default<\/strong>. Spring Shell \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>group<\/code>.<\/p>\n<pre><code class=\"java\">@Command(group = \"Group Commands\") public class GroupCommands {       @Command()     public String helloWorldGroup() {         return \"Hello World Group!\";     }   }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u043e\u043a\u0430\u0436\u0438\u0442\u0435 help \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>hello-world-group<\/code>. <\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar help AVAILABLE COMMANDS   Built-In Commands        help: Display help about available commands        history: Display or save the history of previously run commands        version: Show version info        script: Read and execute commands from a file.   Default        hello-world: This command will say hello.   Group Commands        hello-world-group:   $ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar hello-world-group Hello World Group!<\/code><\/pre>\n<h3>6. \u041e\u043f\u0446\u0438\u0438<\/h3>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0435\u043a\u0441\u0442. \u041d\u043e \u0432\u0430\u043c \u0447\u0430\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c <strong>Hello World<\/strong>, \u0432\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <strong>name<\/strong>.<\/p>\n<pre><code class=\"java\">@Command(group = \"Options\") public class Options {       @Command     public String helloName(String name) {         return \"Hello \" + name + \"!\";     } }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>hello-name<\/code> \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0438 \u0431\u0435\u0437.  <\/p>\n<pre><code class=\"bash\">$ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar hello-name Gunter Hello Gunter! $ java -jar target\/myspringshellplanet-0.0.1-SNAPSHOT.jar hello-name Missing mandatory option '--name'<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u043f\u0446\u0438\u0438 \u0415\u0441\u043b\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u0432\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0435 \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@Option<\/code>. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043a <code>@Option<\/code> (\u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>hello-name-default<\/code>) \u0438\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043b\u043e\u0433\u0438\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 (\u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>hello-name-option<\/code>). <\/p>\n<pre><code class=\"java\">@Command public String helloNameDefault(@Option(defaultValue = \"World\") String name) {     return \"Hello \" + name + \"!\"; }   @Command public String helloNameOption(@Option String name) {     if (name == null) <\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-457195","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/457195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=457195"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/457195\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=457195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=457195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=457195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}