このブログですが、Spring MVC 4.1からSpring Boot 1.2.3に移行しました。
https://github.com/af-not-found/blog-java1
https://github.com/af-not-found/blog-java2
移行にあたって移植が必要だったのは、主に以下3点でした。
全体的にスッキリしました。
これは時間がかかりました。でもThymeleaf使いやすくて良いですね。
JSPの自作ELファンクションは、ThymeleafのDialectとしてほとんどそのまま使えました。JSPのTLDファイルが、ThymeleafConfig.javaに置き換わった形です。
以前のエントリで、jetty-maven-pluginを使ったSelenium統合テストとカバレッジ計測方法を紹介しました。
Spring Bootでも同様に、単体テスト・統合テストのカバレッジ計測が実施できます。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Dspring.profiles.active=${spring.profiles.active} ${jacocoArgs}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>-Dspring.profiles.active=${spring.profiles.active} ${jacocoArgs}</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.18</version>
</dependency>
</dependencies>
</plugin>
ポイントはargLine
の${jacocoArgs}
だけです。
jetty-maven-pluginに該当するものが必要なくなったため、かなりスッキリしました。組み込みTomcatの大きな利点です。
逆に、これ以外はほとんど書き換えていません。Serviceクラスとか、SQLとか、Seleniumテストケースも。
Spring Boot良いですね。気に入りました。