准备Spring 5和Spring Boot 2手册的步骤
我们已经升级到了2018-11-27 Spring 5.1 + Spring Boot 2.1!
在亲身体验中,请携带已准备好的个人笔记本电脑。
如果有关于任何准备事项方面的疑问,请在Twitter上回复或私信给我的帐号@suke_masa,我会回答您!
下载幻灯片
以下是Spring概述讲座的资料,用于前30分钟的使用。为了在后续的实践中作为参考,建议从以下链接下载到本地保存。
提前安装的东西
PC建议使用64位操作系统,内存最好为4GB或以上。操作系统可以是Windows/macOS/Linux中的任何一个。
JDK 11
ZuluやAdoptOpenJDKなど、どのビルドでもおそらく動くと思いますが、僕はリンク先にあるOracleビルドのOpenJDKを利用しています
環境変数JAVA_HOMEおよびPATHを設定してください
IDEにもJDK 11を設定しておいてください
IDE(下記2点のいずれか)
IntelliJ IDEA
Ultimate Editionを推奨しますが、Community EditionでもOKです
Pleiades All in OneのEclipse 2018-09版
[Java]の[Standard Edition]でOKです
通常のEclipseやSpring Tool Suiteは、JDK 11関連の設定やプラグインの追加が煩雑なため、Pleiades All in Oneをお勧めします
IDEは最新版をインストールしてください。古いバージョンの場合、JDK 11に対応していなかったり、JUnit 5で記述しているテストが実行できないことがあります。
文字コードはUTF-8に設定してください。
curlコマンド(演習6のみ)
Windowsの場合は http://www.paehl.com/open_source/ から「CURL 7.xx.x」の「Download WITHOUT SSL」を選択してダウンロードし、環境変数PATHを設定しておいてください。
macOSの場合はデフォルトでインストール済みです。
jqコマンド(演習6のみ)
Windowsの場合は https://stedolan.github.io/jq/download/ からダウンロードし、ファイル名を「jq.exe」に変更後、環境変数PATHを設定しておいてください。
macOSの場合はHomebrewコマンド brew install jq でインストールできます。
由于使用了内嵌的数据库和应用服务器(H2、嵌入式Tomcat),因此无需进行安装。
源代码的克隆
请使用以下命令从GitHub克隆。
$ git clone https://github.com/MasatoshiTada/spring5-boot2-handson.git
如果是在Eclipse中,导入源代码。
(1) 启动Eclipse。
(2) 选择[文件]-[导入]。
(3) 选择[Maven]-[导入现有的Maven项目],然后选中[下一步]。

点击[根目录]下的[浏览]按钮,选择克隆的[spring5-boot2-handson]文件夹。

请确认所有四个项目([01-spring5]、[02-spring5-answer]、[03-boot2]、[04-boot2-answer])都被正确显示并被勾选,然后选择[完成]。

(6)项目导入开始。为了从Maven中央仓库下载库文件,可能需要一些时间。
导入源代码(适用于IntelliJ IDEA)
(1) 打开 IntelliJ IDEA 并选择 [导入项目]。

选择克隆的[spring5-boot2-handson]文件夹。

(3) 选择[从外部模型导入项目]-[Maven],然后选择[下一步]。

勾选[以递归方式搜索项目],然后点击[下一步]。

如果在下一步之前出现以下屏幕,请直接选择“下一步”。这样,屏幕就会切换到第五步的画面。

确认所有4个项目([01-spring5]·[02-spring5-answer]·[03-boot2]·[04-boot2-answer])都被显示出来,并且已经被勾选后,选中[Next]。
如果上述四个项目没有显示在列表中,那么选择的文件夹可能是错误的(在选项2)。

(6) 直接选择“完成”。

(7) 开始导入项目。由于需要从Maven中央仓库下载库文件,可能会花费一些时间。
验证答案示例的执行
请在02-spring5-answer项目的com.example.Main类中执行main()方法。
请使用[Eclipse]中的[Run As]-[Java Application]来运行。
请检查控制台。如果没有显示堆栈跟踪等信息,而是最后显示“信息: Starting ProtocolHandler [“http-nio-8080”]”,则表示内置的Tomcat已成功在端口号8080上启动。

(3)在 Web 浏览器中访问 http://localhost:8080/sample/。将显示登录页面,请使用邮箱地址 admin@example.com 和密码 admin 进行登录。
(4) 要顺利通过,需要显示出以下5位顾客的信息。

请停止main()方法。现在准备步骤已经完成。
开始实用操作
请先读一遍幻灯片。
(2) 01-spring5/todo-1.md 是演習1的步骤。