title: Unable to override JMS Serializer's default handler for Symfony ConstraintViolationList
body: <p>I am unable to override default handlers in jms serializer bundle.</p>
  
  <p>I'd like to change the way <code>Symfony\Component\Validator\ConstraintViolationList</code> is serialized so I wrote my own custom handler. And tagged it correctly as described in the documentation (and in various stackoverflow answers). </p>
  
  <p>However, my handler keeps being overridden by the default handler for ConstraintViolationList that JMS Serializer bundle ships with.</p>
  
  <p>I've tagged my handler service correctly. In fact, my handler service is detected and used correctly when I comment out <code>ms_serializer.constraint_violation_handler</code> service definition from <code>vendor/jms/serializer-bundle/JMS/SerializerBundle/Resources/config/services.xml</code></p>
  
  <p><strong>How can I stop the default handler from overriding my custom one?</strong></p>
  
  <p>I've even tried overriding <code>jms_serializer.constraint_violation_handler.class</code> parameter from my own bundle but still no luck. </p>
  
  <p>Here is my Handler class:</p>
  
  <pre><code>&lt;?php
  namespace Coanda\Bridge\JMSSerializer\Handler;
  
  use JMS\Serializer\Context;
  use JMS\Serializer\GraphNavigator;
  use JMS\Serializer\Handler\SubscribingHandlerInterface;
  use JMS\Serializer\JsonSerializationVisitor;
  use Symfony\Component\Validator\ConstraintViolation;
  use Symfony\Component\Validator\ConstraintViolationList;
  
  class ConstraintViolationHandler implements SubscribingHandlerInterface
  {
      public static function getSubscribingMethods()
      {
          $methods = [];
          $methods[] = [
              'direction' =&gt; GraphNavigator::DIRECTION_SERIALIZATION,
              'type' =&gt; ConstraintViolationList::class,
              'format' =&gt; 'json',
              'method' =&gt; 'serializeListToJson'
          ];
          return $methods;
      }
  
      public function serializeListToJson(
          JsonSerializationVisitor $visitor,
          ConstraintViolationList $list,
          array $type,
          Context $context
      ) {
          $violations = [];
          foreach ($list as $item) {
              $violations[$item-&gt;getPropertyPath()][] = $item-&gt;getMessage();
          }
          if (null === $visitor-&gt;getRoot()) {
              $visitor-&gt;setRoot($violations);
          }
          return $violations;
      }
  
  }
  </code></pre>
  
  <p>I've registered it in my <code>services.xml</code>  </p>
  
  <pre><code>    &lt;service id="coanda.serializer.constraint_violation_handler"
          class="Coanda\Bridge\JMSSerializer\Handler\ConstraintViolationHandler"&gt;
          &lt;tag name="jms_serializer.subscribing_handler"
              type="Symfony\Component\Validator\ConstraintViolationList"
              direction="serialization" format="json" method="serializeListToJson" /&gt;
      &lt;/service&gt;
  </code></pre>