2.5. Spring Boot アプリケーションの実行
Red Hat build of 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.2.0.redhat-00034</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 / Red Hat buuld of HawtIO --> <dependency> <groupId>org.apache.camel.springboot</groupId> <artifactId>camel-management-starter</artifactId> </dependency> <!-- (Optional) Required for Red Hat buuld of 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に追加して、Red Hat build of HawtIO および Jolokia エンドポイントを有効にします。spring.jmx.enabled = true management.endpoints.web.exposure.include = hawtio,jolokia次のように、開発モードで Spring Boot アプリケーションを使用して Red Hat build of HawtIO を実行します。
mvn spring-boot:run- http://localhost:8080/actuator/hawtio を開いて、Red Hat build of HawtIO コンソールを表示します。
2.5.1. Red Hat build of HawtIO パスの設定 リンクのコピーリンクがクリップボードにコピーされました!
Red Hat build of HawtIO エンドポイントに /actuator ベースパスを使用しない場合は、次のコマンドを実行することもできます。
management.endpoints.web.base-pathプロパティーを使用して Spring Boot 管理ベースパスをカスタマイズします。management.endpoints.web.base-path = /management.endpoints.web.path-mapping.hawtioプロパティーを設定して、Red Hat build of HawtIO エンドポイントへのパスをカスタマイズすることもできます。management.endpoints.web.path-mapping.hawtio = hawtio/console以下に例を示します。
- Red Hat build of HawtIO Spring Boot の例を使用して、Apache Camel ルート、メトリクスなどに関する情報を公開する Web アプリケーションを監視する方法を示す、実用的な Spring Boot の例 があります。
-
リアルタイム値とチャートに適した MBean は
java.lang/OperatingSystemです。Camel ルートを確認してください。ツリー内で選択を変更すると、その内容に基づいて使用可能なタブのリストが動的に変化します。