LoginSignup
0
0

More than 1 year has passed since last update.

VaadinのLive Reload方法

Posted at

Vaadin

アプリケーション起動中にソースコードを変更した際に明示的な再起動を伴わずに即時反映する方法を調べたので記事に起こします。

公式サイトの以下を参考にしています。

Redeploying During Development

When you save a source file, the IDE automatically compiles it. The web server tracks the compiled files and automatically redeploys the application when it notices a change. You can then refresh the page to use the updated version.
You can also enable live reload to have the page refreshed automatically, as described in Live Reload.

Live Reload

フロントエンド側のコード(css,js,tsフォルダ内のファイル)はwebpack-dev-serverが変更監視をしていて、サーバサイド側のコード(java)はSpring Boot Developers Toolsがサポートするそうです。
厳密にはもう少し選択肢がありますが正確には上記リンクから英語ドキュメントを参照してください。

Spring Boot Developers Tools

pomに記述を追加するだけです。vaadinの公式からダウンロードするプロジェクトには最初から書いてありました。

<dependencies>
    ...
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>
</dependencies>

これで動かない場合はintellijを使っている場合は設定を見直してください。
intellijのバージョンによって代わってくるのですが以下の2点です。

1) build project automatically

2) 2021.2の場合は以下でアプリ起動中にコンパイルを許可する

なお、上記はVaadinに限らずにintellij+springの場合も有効なはずです。(vaadinはバックにspringがあり、spring側の設定をいれて変更を反映する仕組みのようです)

0
0
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
0
0