LoginSignup
2
2

More than 5 years have passed since last update.

Spring FEST 2018に参加した感想

Last updated at Posted at 2018-10-31
1 / 18

今回SpringFest2018に参加してきましたが、数あるセッションの中でも、一つのセッションに注目しました。
その概要と個人的感想を中心にシェアできたらと思い作成しました。
セッションの詳しい内容につきましては、後日公開される予定である公式ページの資料をご確認ください。
公式ページ: http://springfest2018.springframework.jp/


イベント概要

SpringFest2018とは、SpringFrameworkを使用するユーザ間での情報交換や交流の場であり、更なるSpringFrameworkの普及促進を目指すイベントです。

980c5fe716efb66c936eebe1937d5489.png


参加したセッション

  • RakutenTravel and Spring
  • KeyNote
  • エンタープライズ・マイクロサービスの格言
  • Observability with Spring-Based Distributed System
  • 業務で使いたいWebFluxによる Reactiveプログラミング

今回注目したのは...

RakutenTravel and Spring

by Kalburgi Gajraj さん (from 楽天トラベル)


概要

楽天トラベル開発で用いられているSpringに関連する技術についての紹介


コンテンツ

  1. Spring Initializer
  2. Spring Cloud Config
  3. Spring Boot Actuator
  4. Spring Boot Admin
  5. Swagger

Spring Initializer

  • プロジェクトやモジュールを作る際に必要な構成を作るのを手助けしてくれる便利なもの
  • WebUIでプロジェクト構成を設定すると、自動的に生成してくれる
  • IntelliJ IDEAの有償版を使用している場合は標準プラグインとして使用できる

以下のキャプチャのように簡単に生成できる!
- URL : https://start.spring.io/
スクリーンショット 2018-10-31 17.19.52.png


Spring Cloud Config

  • 分散システムにおいて複数のアプリケーションの設定を一元化することをサポートしてくれるもの(設定の共通化??)
  • 簡単にいうと設定ファイルを集約してくれるらしい
  • 公式ドキュメント:https://cloud.spring.io/spring-cloud-config/

Spring boot’s Actuator

  • システムの状態を確認するためのエンドポイントを追加してくれる
  • メトリクスやSpringに登録されているbean一覧を確認できる
  • 代表的なものを挙げると、以下のようなものがある

①/health  ②/info  ③/env  ④/loggers


使い方

1.build.gradleに依存性を追加

build.gradle
repositories {
    mavenCentral()
}

dependencies {
    implementation('org.springframework.boot:spring-boot-starter-actuator')
    implementation('org.springframework.boot:spring-boot-starter-web')
    testImplementation('org.springframework.boot:spring-boot-starter-test')
}

使い方

2.公開したいエンドポイントを設定

application.yml
management:
  endpoints:
    web:
      exposure:
        include: env,beans,loggers,health,info


使い方

3.こんな感じでcurlする

-> % curl "http://localhost:8080/actuator/env"
{"activeProfiles":[],"propertySources":[{"name":"server.ports","properties":{"local.server.port":{"value":8080}}},{"name":"servletContextInitParams","properties

-> % curl "http://localhost:8080/actuator/health"
{"status":"UP"}% 


Spring boot Admin

  • Spring boot Applicationのための管理画面を提供してくれる
  • メトリクスやログ、アプリで実行されているスレッドなどを確認できる
  • サーバー側の設定とクライアント側の設定(モニタリングされる側)が必要
  • ガイド:http://codecentric.github.io/spring-boot-admin/current/

ざっくりした使い方

1.Server側のbuild.gradleに依存性を追加
2.Server側に@EnableAdminServerを付与
3.Client側のアプリのbuild.gradleにも依存性を追加
4.Client側のapplication.ymlにAdminServerへの接続情報を追加
5.エンドポイントにアクセスすると管理画面が表示される


Swagger

  • APIの開発を高速化する
  • API情報の可視化をしてくれる
  • エンドポイントのテストを容易にする
  • 公式ページ:https://swagger.io/

感想

  • 己のSpringFrameworkの仕様に関する理解度不足を知った
  • 業務上使ってるアノテーションなどの身近な部分から、SpringBootの全般的な内部動作までを復習しようと思いました!
  • やる気が出た!
2
2
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
2
2