Spring, Spring Bootよく忘れること
SpringBoot Spring シュッと出したい
Spring, Spring Boot共通
Spring Profileの設定について
https://www.baeldung.com/spring-profiles
mavenのspring-boot-maven-pluginへの起動時のパラメータの与え方
-Dspring-boot.run.jvmArguments="-Dspring.profiles.active=dev"
https://spring.pleiades.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#run
DI, AOP
https://www.docswell.com/s/MasatoshiTada/Z818E5-spring-di-aop-for-every-developers
ハマりどころ
同一クラス内のメソッド呼び出しではAOPの割り込みが起こらない
https://spring.pleiades.io/spring-framework/reference/core/aop/proxying.html#:~:text=呼び出しが最終的にターゲットオブジェクト%EF%BC%88この場合は%C2%A0SimplePojo%C2%A0参照%EF%BC%89に到達すると%E3%80%81this.bar()%C2%A0や%C2%A0this.foo()%20など%E3%80%81それ自体で行うメソッド呼び出しは%E3%80%81プロキシではなく%C2%A0this%C2%A0参照に対して呼び出されます%E3%80%82これには重要な意味があります%E3%80%82つまり%E3%80%81自己呼び出しでは%E3%80%81メソッド呼び出しに関連するアドバイスが実行される可能性はありません%E3%80%82
https://www.docswell.com/s/MasatoshiTada/Z818E5-spring-di-aop-for-every-developers#p66
@Valueによるpropertyのバインディング
https://spring.pleiades.io/spring-framework/reference/core/beans/annotation-config/value-annotations.html
Spring Boot
AutoConfiguration
https://qiita.com/kazuki43zoo/items/8645d9765edd11c6f1dd
起動時のスキーマ, データの初期化
https://spring.pleiades.io/spring-boot/docs/current/reference/html/howto.html#howto.data-initialization.using-basic-sql-scripts
spring-boot-docker-compose
https://zenn.dev/backpaper0/articles/c9d6e3c54e783e
Spring Boot Actuatorのhealth以外のエンドポイントの公開
https://zenn.dev/kojikaya/articles/a598499ecbb431#health-以外のエンドポイントの公開設定
BuildPackによるDockerImageのbuild
SpringのDocker Image作る
BuildPack自体について
https://amateur-engineer-blog.com/getting-started-cloud-native-buildpacks/
@ConfigurationPropertiesによるpropertyのバインディング
https://spring.pleiades.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties
だいたい久しぶりに書くと、@SpringBootApplication ついたクラスに @ConfigurationPropertiesScan をつけるのを忘れてあれーコンパイルエラーになるなーというので少しハマる
recordにもつけられるのでImmutableなクラスでも受けられるようになった (昔は@ConstructorBindings もつける必要ががったけどSpringBoot3以降は不要)
https://stackoverflow.com/a/66696829
@Valueとの違い
https://spring.pleiades.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.vs-value-annotation
複数のpropertyを構成することは@Valueはできない
@ConfigurationPropetiesは型安全だったり、構造をつくれるのでSpringBoot使ってる場合は基本こちらを選択したほうがよさそう