title: Spring boot + gradle + tomcat hello world app not working
body: <p>I am trying to implement a basic hello world web application using spring boot, gradle and tomcat. I have following java classes. When I execute "./gradlew clean tomcatRunWar" tomcat just starts but unable to access.</p>
  
  <p>What could be the issue?</p>
  
  <p>build.gradle</p>
  
  <pre><code>buildscript {
      repositories {
          mavenLocal()
          mavenCentral()
      }
      dependencies {
          classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:0.9.8'
          classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.1.6.RELEASE'
      }
  }
  
  apply plugin: 'java'
  apply plugin: 'eclipse-wtp'
  apply plugin: 'idea'
  apply plugin: 'spring-boot'
  apply plugin: 'war'
  apply plugin: 'tomcat'
  
  mainClassName = "au.com.aeas.config.WebAppInitializer"
  
  war {
      baseName = ''
      version =  '0.0.0'
  }
  
  repositories {
      mavenLocal()
      mavenCentral()
  }
  
  configurations {
      providedRuntime
  }
  
  dependencies {
      tomcat "org.apache.tomcat.embed:tomcat-embed-core:7.0.42",
          "org.apache.tomcat.embed:tomcat-embed-logging-juli:7.0.42"
      tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:7.0.42") {
          exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
      }
  
      compile 'org.springframework.security:spring-security-config:3.2.5.RELEASE'
      compile 'org.springframework.security:spring-security-web:3.2.5.RELEASE'
      compile("org.springframework.boot:spring-boot-starter-web:1.1.6.RELEASE")
      providedRuntime("org.springframework.boot:spring-boot-starter-tomcat:1.1.6.RELEASE")
  }
  
  task wrapper(type: Wrapper) { gradleVersion = '1.6' }
  </code></pre>
  
  <ol>
  <li><p>WebAppInitializer.java</p>
  
  <pre><code>  @EnableAutoConfiguration
    @ComponentScan("au.com.aeas.web.controller")
    @Controller
    public class WebAppInitializer extends WebMvcConfigurerAdapter {
  
    public static void main(String[] args) throws Exception {
       new SpringApplicationBuilder(WebAppInitializer.class).run(args);
    }
  
    @Bean
    public ApplicationSecurity applicationSecurity() {
       return new ApplicationSecurity();
    }
  
    @Bean
    public InternalResourceViewResolver viewResolver() {
       InternalResourceViewResolver internalResourceViewResolver = new InternalResourceViewResolver();
       internalResourceViewResolver.setPrefix("WEB-INF/views/");
       internalResourceViewResolver.setSuffix(".jsp");
       return internalResourceViewResolver;
    }
  
    @Bean
    public AuthenticationSecurity authenticationSecurity() {
       return new AuthenticationSecurity();
    }
  
    @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
    protected static class ApplicationSecurity extends
      WebSecurityConfigurerAdapter {
  
      @Autowired
      private SecurityProperties security;
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
           http.authorizeRequests().anyRequest().fullyAuthenticated().and()
              .formLogin();
      }
    }
  
    @Order(Ordered.HIGHEST_PRECEDENCE + 10)
    protected static class AuthenticationSecurity extends
      GlobalAuthenticationConfigurerAdapter {
  
    @Override
    public void init(AuthenticationManagerBuilder auth) throws Exception {
         auth.inMemoryAuthentication().withUser("user").password("password")
              .roles("USER");
     }
    }
   }
  </code></pre></li>
  <li><p>HelloController.java</p>
  
  <pre><code>@Controller
  public class HelloController {
  
    @RequestMapping(value = "/hello", method = RequestMethod.GET)
    public ModelAndView hello() {
      ModelAndView modelAndView = new ModelAndView();
      modelAndView.addObject("message", "charith");
      modelAndView.setViewName("hello");
      return modelAndView;
    }
  
  }
  </code></pre></li>
  <li><p>hello.jsp</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Hello world page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;h1&gt;${message}&lt;/h1&gt;
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre></li>
  </ol>