/**
  * Configure the handler with an {@link
  * org.springframework.integration.aggregator.MethodInvokingCorrelationStrategy} for the target
  * object and method name.
  *
  * @param target the target object.
  * @param methodName the method name.
  * @return the handler spec.
  * @see AbstractCorrelatingMessageHandler#setCorrelationStrategy(CorrelationStrategy)
  */
 public S correlationStrategy(Object target, String methodName) {
   try {
     CorrelationStrategyFactoryBean correlationStrategyFactoryBean =
         new CorrelationStrategyFactoryBean();
     correlationStrategyFactoryBean.setTarget(target);
     correlationStrategyFactoryBean.setMethodName(methodName);
     correlationStrategyFactoryBean.afterPropertiesSet();
     return correlationStrategy(correlationStrategyFactoryBean.getObject());
   } catch (Exception e) {
     throw new IllegalStateException(e);
   }
 }