Search code examples
springspring-annotations

How to set context root of a web app using spring 4.1 using annotations


I am trying to set up a simple web app using spring annotations. I am referring to sample projects given in spring site. Can anyone let me know how can I set the context root to below given example?

https://github.com/spring-guides/tut-web/tree/master/6/complete.

I can build it locally and access it as http://localhost:8080/

I want to access it like http://localhost:8080/spring

Thanks


Solution

  • Found the solution in the same build file. We need to set

    tomcatRunWar.contextPath = 'spring'
    

    in build.gradle