spring-bootswaggerspringfox-boot-starter

"Ambiguous search mapping detected" thrown after adding Springfox 3.0.0 to SpringBoot


I have a SpringBoot application (spring-boot-starter-parent:2.4.0) and I want to use Swagger. I followed this Baeldung-Tutorial, and I am unfortunately getting this exception on startup:

org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.IllegalStateException: Ambiguous search mapping detected.

This is due to the fact that I am in some cases overloading methods in my repositories as follows:

Page<Message> findByConversationId(Long conversationId, Pageable pageable);
List<Message> findByConversationId(Long conversationId);

The exception says that both methods

are mapped to /findByConversationId! Tweak configuration to get to unambiguous paths!

Is there any way to overcome this issue ? Thank you !


Solution

  • This is not an answer to your problem but it might help you. Consider using springdoc instead of Springfox. It is a newer library that is easier to use and way less error-prone than Springfox. We moved to it 2 years ago and we are very glad we did. There is very good documentation and tutorials online for it:

    It is also very active and you usually get your issues answered very fast on the github page.