LoginSignup
3
5

More than 5 years have passed since last update.

MyBatis JPetStoreのSpring Boot版を作ってみた

Last updated at Posted at 2016-10-16

MyBatisが提供しているサンプルWebアプリケーション(MyBatis JPetStore)をSpring Boot(Spring MVC, Spring Security) + Thymeleafで作り直してみました。
画面仕様や機能仕様は基本的にはオリジナル版と同じですが、微妙にかえているところもあります(あしからず・・・)。

主なスタック

  • MyBatis Spring Boot Starter 1.1 (MyBatis 3.4, MyBatis Spring 1.3)
  • Spring Boot 1.4 (Spring Framework 4.3)
  • Spring Security 4.2
  • Thymeleaf 3.0
  • HSQLDB 2.3 (Embed Database)
  • Tomcat 8.5 (Embed Application Server)
  • Java 8
  • Groovy 2.4 (Mapperメソッドのアノテーション内で複数行文字列を使うために利用)
  • Lombok 1.6

ソースコード

GitHubで公開してます。

解説

ソースみてください!!
(気が向いたら書きます・・・:sweat_smile:

その他

入力チェックや排他処理など・・・いくつか改善した方がよさそうな箇所があるので、予告なく変更すると思います。あと、テストも追加したいと思っています。
Thymeleafは詳しくないので・・・へんな実装があるかもしれません。(いや、たぶんある・・・:sweat_smile:

まとめ

Spring Boot(Spring MVC,Spring Security) + Thymeleaf + MyBatisを使った画面系アプリのサンプルでした。
このサンプルアプリケーションを理解することで、Spring MVCを利用した画面遷移処理、Spring Securityを利用した認証・認可、Bean Validationを利用した入力チェック、Springのセッション管理、Springのイベント通知、Thymeleafを利用したView実装、MyBatisを利用したDBのCRUD操作ができるようになります。

3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5