Skip to content

Commit

Permalink
Introduce autoconfiguration for the AxonServerHealthIndicator
Browse files Browse the repository at this point in the history
Introduce an autoconfiguration class constructing an
AxonServerHealthIndicator bean if actuator is present on the classpath

#1964
  • Loading branch information
smcvb committed Feb 24, 2022
1 parent 2c44bec commit 980bdf4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2010-2022. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.axonframework.springboot.autoconfig;

import org.axonframework.actuator.AxonServerHealthIndicator;
import org.axonframework.axonserver.connector.AxonServerConnectionManager;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* Autoconfiguration class for Spring Boot Actuator monitoring tools around Axon Server.
*
* @author Steven van Beelen
* @since 4.6.0
*/
@Configuration
@AutoConfigureAfter(AxonServerAutoConfiguration.class)
@ConditionalOnClass(name = {"org.springframework.boot.actuate.health.AbstractHealthIndicator"})
@ConditionalOnProperty(name = "axon.axonserver.enabled", matchIfMissing = true)
public class AxonServerActuatorAutoConfiguration {

@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Bean
public AxonServerHealthIndicator axonServerHealthIndicator(AxonServerConnectionManager connectionManager) {
return new AxonServerHealthIndicator(connectionManager);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.axonframework.springboot.autoconfig.InfraConfiguration,\
org.axonframework.springboot.autoconfig.ObjectMapperAutoConfiguration,\
org.axonframework.springboot.autoconfig.AxonServerAutoConfiguration,\
org.axonframework.springboot.autoconfig.XStreamAutoConfiguration
org.axonframework.springboot.autoconfig.XStreamAutoConfiguration,\
org.axonframework.springboot.autoconfig.AxonServerActuatorAutoConfiguration

0 comments on commit 980bdf4

Please sign in to comment.