When running an application the path to call consists of a couple of parts.
When running an application the path to call consists of a couple of parts.

The first is the base URL on which the application is deployed, in your case that is /sophia.

The second is the servlet mapping of the DispatcherServlet in your case that is /sohpia/*.

The third is the mapping of the controller inside the DispatcherServlet, in your example that is /users.

All those things combined create the URL /sophia/sophia/users.

The difference between the deployment as a WAR is that you included a separate URL to deploy on, when running as a jar it, by default, is deployed to / (the root).

You could fix it by putting /sophia as the server.context-path in the application.properties and map the DispatcherServlet to /* or /. That will in both situations give you the URL you want (and expected).

levioZ/gradle_springMVC_resful_mybatis