All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.spring.starter.remote.InfinispanJmxConfiguration Maven / Gradle / Ivy

There is a newer version: 14.0.31.Final
Show newest version
package org.infinispan.spring.starter.remote;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.jmx.export.MBeanExporter;

/**
 * Spring and Infinispan register the same bean. Avoid an exception telling Spring not to export Infinispan's
 * bean
 *
 * @since 2.1.x
 */
@Configuration
@ConditionalOnProperty(prefix = "infinispan.remote", name = "jmx", havingValue = "true")
public class InfinispanJmxConfiguration {

   private final ObjectProvider mBeanExporter;

   InfinispanJmxConfiguration(ObjectProvider mBeanExporter) {
      this.mBeanExporter = mBeanExporter;
   }

   @PostConstruct
   public void excludeRemoteCacheManagerMBean() {
      this.mBeanExporter
            .ifUnique((exporter) -> exporter.addExcludedBean("remoteCacheManager"));
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy