How to register jpa converter in spring boot?
<p>I've an entity called <code>Lawyer</code> and the following piece of code in a <code>LawyerRepository</code>:</p>

<pre><code>import javaslang.control.Option;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface LawyerRepository extends JpaRepository&lt;Lawyer, Long&gt; {

    @Query("select distinct l from Lawyer l where l.account.username = :email")
    Option&lt;Lawyer&gt; findLawyerByEmail(@Param("email") String email);

}
</code></pre>

<p>As you can see I'd like to return <code>javaslang.control.Option</code> instead of <code>java.util.Optional</code>. It results in the following exception:</p>

<blockquote>
  <p>org.springframework.core.convert.ConversionFailedException: Failed to
  convert from type [java.util.ArrayList] to type
  [javaslang.control.Option] for value '[lawyer.Lawyer@5e4c0db5]';
  nested exception is
  org.springframework.core.convert.ConverterNotFoundException: No
  converter found capable of converting from type
  [java.util.ArrayList] to type [javaslang.control.Option]</p>
</blockquote>

<p>And here's the converter:</p>

<pre><code>import javaslang.control.Option;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import java.util.ArrayList;

@Component
public class OptionConverter implements Converter&lt;ArrayList&lt;?&gt;, Option&lt;?&gt;&gt; {

    @Override
    public Option&lt;?&gt; convert(ArrayList&lt;?&gt; input) {
        if (true) {
            throw new RuntimeException("lol");
        }
        return null;
    }

}
</code></pre>

<p>My question is how to register the converter I provided properly?</p>