2.4. Spring Boot アプリケーションの実行
HawtIO は 2 つのステップで Spring Boot アプリケーションに接続できます。
手順:
io.hawt:hawtio-springbootおよびサポートする Camel Spring Boot スターターをpom.xmlの依存関係に追加します。<dependencyManagement> <dependencies> <dependency> <groupId>io.hawt</groupId> <artifactId>hawtio-bom</artifactId> <version>4.0.0.redhat-00040</version> <type>pom</type> <scope>import</scope> </dependency> <!-- ... other BOMs or dependencies ... --> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>io.hawt</groupId> <artifactId>hawtio-springboot</artifactId> </dependency> <!-- Mandatory for enabling Camel management via JMX / Hawtio --> <dependency> <groupId>org.apache.camel.springboot</groupId> <artifactId>camel-management-starter</artifactId> </dependency> <!-- (Optional) Required for Hawtio Camel route diagram tab --> <dependency> <groupId>org.apache.camel.springboot</groupId> <artifactId>camel-spring-boot-xml-starter</artifactId> </dependency> <!-- ... other dependencies ... --> </dependencies>次の行を
application.propertiesに追加して、HawtIO および Jolokia エンドポイントを有効にします。spring.jmx.enabled = true management.endpoints.web.exposure.include = hawtio,jolokia次のように、Spring Boot アプリケーションを開発モードで使用して HawtIO を実行します。
mvn spring-boot:run- http://localhost:8080/actuator/hawtio を開き、HawtIO コンソールを表示します。
2.4.1. HawtIO パスの設定 リンクのコピーリンクがクリップボードにコピーされました!
HawtIO エンドポイントに /actuator ベースパスを使用しない場合は、次のコマンドを実行することもできます。
management.endpoints.web.base-pathプロパティーを使用して Spring Boot 管理ベースパスをカスタマイズします。management.endpoints.web.base-path = /management.endpoints.web.path-mapping.hawtioプロパティーを設定して、HawtIO エンドポイントへのパスをカスタマイズすることもできます。management.endpoints.web.path-mapping.hawtio = hawtio/console以下に例を示します。
- HawtIO Spring Boot example に、実際に動作する Spring Boot の例があります。この例は、Apache Camel ルート、メトリクスなどに関する情報を公開する Web アプリケーションを監視する方法を示します。
-
リアルタイム値とチャートに適した MBean は
java.lang/OperatingSystemです。Camel ルートを確認してください。ツリー内で選択を変更すると、その内容に基づいて使用可能なタブのリストが動的に変化します。