Skip to content

Spring解体新書第二版をhands onでやるリポジトリ

Notifications You must be signed in to change notification settings

okaponta/spring-kaitai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 

Repository files navigation

spring-kaitai

Spring解体新書第二版をhands onでやりました。
Spring/SpringBootはやっていた当時の最新バージョンを使っているため、
本のサンプルコードと異なるコードになっている部分があります。

バージョン

  • Java OpenJDK17
  • SpringBoot v2.7.0

バージョンアップ起因で変更した点

初期化時のSQLの指定方法

バージョンアップにより、application.propertiesの記述方法が変わっています。

詳しくは以下に書いています。

Recordの使用

java16から正式リリースされたRecordを使用して一部のクラスを記述しています。
具体的には以下の2クラス

これに伴い、ModelMapperの設定を一部変えています。

詳しくは以下にまとめています。

SecurityConfigの書き方変更

SpringSecurity5.7からWebSecurityConfigurerAdapterがdeprecatedになって、本で記載されている書き方が非推奨となりました。
これで、SecurityConfigを書き直しています。

大きな変更点は以下

  • WebSecurityConfigurerAdapterの継承をやめた
  • configure(WebSecurity) -> WebSecurityCustomizerのBean登録
  • configure(HttpSecurity) -> SecurityFilterChainのBean登録
  • configure(AuthenticationManagerBuilder) -> InMemoryUserDetailsManagerのBean登録(インメモリの場合)
  • configure(AuthenticationManagerBuilder) -> UserDetailsManagerのBean登録

やってたときのログ(Zenn)

https://zenn.dev/okaponta/scraps/97f0e25eeecd36

About

Spring解体新書第二版をhands onでやるリポジトリ

Topics

Resources

Stars

Watchers

Forks