javax.management.InstanceAlreadyExistsException while deploying spring application
<pre><code>&lt;int:poller fixed-delay="${fixedDelay}" default="true"&gt;
        &lt;int:advice-chain&gt;
            &lt;ref bean="pollAdvise"/&gt;

        &lt;/int:advice-chain&gt;
    &lt;/int:poller&gt;


    &lt;bean id="pollAdvise" class="org.springframework.integration.scheduling.PollSkipAdvice"&gt;
        &lt;constructor-arg ref="healthCheckStrategy"/&gt;

    &lt;/bean&gt;



    &lt;bean id="healthCheckStrategy" class="test.main.ServiceHealthCheckPollSkipStrategy"&gt;
        &lt;property name="url" value="${url}"/&gt;
        &lt;property name="doHealthCheck" value="${doHealthCheck}"/&gt;
        &lt;property name="restTemplate" ref="restTemplate"/&gt;

    &lt;/bean&gt;

    &lt;bean id="restTemplate"
          class="org.springframework.web.client.RestTemplate"&gt;
        &lt;constructor-arg ref="requestFactory"/&gt;

    &lt;/bean&gt;


    &lt;bean id="requestFactory"
          class="test.BatchClientHttpRequestFactory"&gt;
        &lt;constructor-arg ref="verifier"/&gt;

    &lt;/bean&gt;
</code></pre>

<p>and my health check strategy looks like below</p>

<pre><code>@ManagedResource
public class ServiceHealthCheckPollSkipStrategy  implements PollSkipStrategy  {


    private volatile boolean skip=false;
    private String url;
    private static String doHealthCheck;
    private RestTemplate restTemplate;

    public RestTemplate getRestTemplate() {
        return restTemplate;
    }

    public void setRestTemplate(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getDoHealthCheck() {
        return doHealthCheck;
    }

    public void setDoHealthCheck(String doHealthCheck) {
        ServiceHealthCheckPollSkipStrategy.doHealthCheck= doHealthCheck;
    }

    @Override
    public boolean skipPoll() {


            if(doHealthCheck.equals("false")){
            return this.skip;
        }
        else if(doHealthCheck.equals("true")){
        List&lt;String&gt; urlList =getUrlfromEncodedString(url);
        for (String url : urlList) {
            boolean status =performHealthCheck(url);
            if(status==false){
            return this.skip = true;    
            }
        }

        return this.skip;
        }
        else {
            throw  new IllegalArgumentException("do health check can be either true or false");
        }

    }

    /**
     * Skip future polls.
     */
    @ManagedOperation
    public void skipPolls() {
        this.skip = true;
    }


    /**
     * Resume polling at the next {@code Trigger} event.
     */
    @ManagedOperation
    public void reset() {
        this.skip = false;
    }


    private List&lt;String&gt;  getUrlfromEncodedString(String urls) throws IllegalArgumentException
    {
        if(urls==null){
            throw new IllegalArgumentException("urls passed is null");
        }
        List&lt;String&gt; urlList = Arrays.asList(urls.split("\\s*,\\s*"));      
        return urlList;
    }


    private boolean performHealthCheck(String url){
        if(url==null){
            throw new IllegalArgumentException("url passed is null");
        }


        HttpHeaders headers = new HttpHeaders();
        headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
        headers.setContentType(MediaType.APPLICATION_JSON);
        headers.set("API-Key", "RTM");

        HttpEntity&lt;String&gt; request = new HttpEntity&lt;String&gt;("parameters", headers);

        ResponseEntity&lt;String&gt; response = restTemplate.
                  exchange(url, HttpMethod.OPTIONS, request, String.class);

         if (response.getStatusCode().toString().equals("200")){
             return  true;
           }

        return false;
    }
}
</code></pre>

<p>I get below exception </p>

<pre><code>Unable to register MBean [test.main.ServiceHealthCheckPollSkipStrategy@73d4b814] with key 'healthCheckStrategy'; nested exception is javax.management.InstanceAlreadyExistsException: test.main:name=healthCheckStrategy,type=ServiceHealthCheckPollSkipStrategy
    at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:625)
    at org.springframework.jmx.export.MBeanExporter.registerBeans(MBeanExporter.java:550)
    at org.springframework.jmx.export.MBeanExporter.afterSingletonsInstantiated(MBeanExporter.java:432)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:775)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139)
    at org.springframework.xd.module.core.SimpleModule.initialize(SimpleModule.java:213)
    at org.springframework.xd.dirt.module.ModuleDeployer.doDeploy(ModuleDeployer.java:217)
    at org.springframework.xd.dirt.module.ModuleDeployer.deploy(ModuleDeployer.java:200)
    at org.springframework.xd.dirt.server.container.DeploymentListener.deployModule(DeploymentListener.java:365)
    at org.springframework.xd.dirt.server.container.DeploymentListener.deployStreamModule(DeploymentListener.java:334)
    at org.springframework.xd.dirt.server.container.DeploymentListener.onChildAdded(DeploymentListener.java:181)
    at org.springframework.xd.dirt.server.container.DeploymentListener.childEvent(DeploymentListener.java:149)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:503)
    at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92)
    at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297)
    at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:83)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:500)
    at org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$10.run(PathChildrenCache.java:762)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: javax.management.InstanceAlreadyExistsException: test.main:name=healthCheckStrategy,type=ServiceHealthCheckPollSkipStrategy
    at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
    at org.springframework.jmx.support.MBeanRegistrationSupport.doRegister(MBeanRegistrationSupport.java:195)
    at org.springframework.jmx.export.MBeanExporter.registerBeanInstance(MBeanExporter.java:678)
    at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:615)
    ... 30 m
</code></pre>