spring boot related issues

Spring boot issues with following code. see error below and tomcat is running fine

package com.template;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringBootFreemarkerApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringBootFreemarkerApplication.class,  
   args);
    }
}

package controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class TestController {
    @RequestMapping("/welcome")
    public String hello(Model model, @RequestParam(value="name",  
    required=false, defaultValue="World") String name) {
        model.addAttribute("name", name);
        return "welcome";
    }
}



"C:/Program Files/Java/jdk1.8.0_121/bin/java" "-javaagent:C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2017.1.5/lib/idea_rt.jar=54267:C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2017.1.5/bin" -Dfile.encoding=UTF-8 -classpath "C:/Program Files/Java/jdk1.8.0_121/jre/lib/charsets.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/deploy.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/ext/access-bridge-64.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/ext/cldrdata.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/ext/dnsns.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/ext/jaccess.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/ext/jfxrt.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/ext/localedata.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/ext/nashorn.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/ext/sunec.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/ext/sunjce_provider.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/ext/sunmscapi.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/ext/sunpkcs11.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/ext/zipfs.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/javaws.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/jce.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/jfr.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/jfxswt.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/jsse.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/management-agent.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/plugin.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/resources.jar;C:/Program Files/Java/jdk1.8.0_121/jre/lib/rt.jar;C:/SpringBoot/Spring-boot-freemarker/target/classes;C:/Users/shekhar/.m2/repository/org/springframework/boot/spring-boot-starter-freemarker/1.5.6.RELEASE/spring-boot-starter-freemarker-1.5.6.RELEASE.jar;C:/Users/shekhar/.m2/repository/org/springframework/boot/spring-boot-starter/1.5.6.RELEASE/spring-boot-starter-1.5.6.RELEASE.jar;C:/Users/shekhar/.m2/repository/org/springframework/boot/spring-boot/1.5.6.RELEASE/spring-boot-1.5.6.RELEASE.jar;C:/Users/shekhar/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.5.6.RELEASE/spring-boot-autoconfigure-1.5.6.RELEASE.jar;C:/Users/shekhar/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.5.6.RELEASE/spring-boot-starter-logging-1.5.6.RELEASE.jar;C:/Users/shekhar/.m2/repository/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar;C:/Users/shekhar/.m2/repository/ch/qos/logback/logback-core/1.1.11/logback-core-1.1.11.jar;C:/Users/shekhar/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.25/jcl-over-slf4j-1.7.25.jar;C:/Users/shekhar/.m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar;C:/Users/shekhar/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.25/log4j-over-slf4j-1.7.25.jar;C:/Users/shekhar/.m2/repository/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar;C:/Users/shekhar/.m2/repository/org/freemarker/freemarker/2.3.26-incubating/freemarker-2.3.26-incubating.jar;C:/Users/shekhar/.m2/repository/org/springframework/spring-context-support/4.3.10.RELEASE/spring-context-support-4.3.10.RELEASE.jar;C:/Users/shekhar/.m2/repository/org/springframework/spring-beans/4.3.10.RELEASE/spring-beans-4.3.10.RELEASE.jar;C:/Users/shekhar/.m2/repository/org/springframework/spring-context/4.3.10.RELEASE/spring-context-4.3.10.RELEASE.jar;C:/Users/shekhar/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.5.6.RELEASE/spring-boot-starter-web-1.5.6.RELEASE.jar;C:/Users/shekhar/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.5.6.RELEASE/spring-boot-starter-tomcat-1.5.6.RELEASE.jar;C:/Users/shekhar/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.16/tomcat-embed-core-8.5.16.jar;C:/Users/shekhar/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.16/tomcat-embed-el-8.5.16.jar;C:/Users/shekhar/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.16/tomcat-embed-websocket-8.5.16.jar;C:/Users/shekhar/.m2/repository/org/hibernate/hibernate-validator/5.3.5.Final/hibernate-validator-5.3.5.Final.jar;C:/Users/shekhar/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar;C:/Users/shekhar/.m2/repository/org/jboss/logging/jboss-logging/3.3.1.Final/jboss-logging-3.3.1.Final.jar;C:/Users/shekhar/.m2/repository/com/fasterxml/classmate/1.3.3/classmate-1.3.3.jar;C:/Users/shekhar/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.8.9/jackson-databind-2.8.9.jar;C:/Users/shekhar/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.8.0/jackson-annotations-2.8.0.jar;C:/Users/shekhar/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.8.9/jackson-core-2.8.9.jar;C:/Users/shekhar/.m2/repository/org/springframework/spring-web/4.3.10.RELEASE/spring-web-4.3.10.RELEASE.jar;C:/Users/shekhar/.m2/repository/org/springframework/spring-aop/4.3.10.RELEASE/spring-aop-4.3.10.RELEASE.jar;C:/Users/shekhar/.m2/repository/org/springframework/spring-webmvc/4.3.10.RELEASE/spring-webmvc-4.3.10.RELEASE.jar;C:/Users/shekhar/.m2/repository/org/springframework/spring-expression/4.3.10.RELEASE/spring-expression-4.3.10.RELEASE.jar;C:/Users/shekhar/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar;C:/Users/shekhar/.m2/repository/org/springframework/spring-core/4.3.10.RELEASE/spring-core-4.3.10.RELEASE.jar" com.template.SpringBootFreemarkerApplication

  .   ____          _            __ _ _
 /// / ___'_ __ _ _(_)_ __  __ _ / / / /
( ( )/___ | '_ | '_| | '_ // _` | / / / /
 ///  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_/__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.6.RELEASE)

2017-07-30 15:20:08.005  INFO 7612 --- [           main] c.t.SpringBootFreemarkerApplication      : Starting SpringBootFreemarkerApplication on DESKTOP-9LIAED5 with PID 7612 (C:/SpringBoot/Spring-boot-freemarker/target/classes started by shekhar in C:/SpringBoot/Spring-boot-freemarker)
2017-07-30 15:20:08.008  INFO 7612 --- [           main] c.t.SpringBootFreemarkerApplication      : No active profile set, falling back to default profiles: default
2017-07-30 15:20:08.074  INFO 7612 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot[email protected]3bd94634: startup date [Sun Jul 30 15:20:08 IST 2017]; root of context hierarchy
2017-07-30 15:20:10.322  INFO 7612 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-07-30 15:20:10.333  INFO 7612 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2017-07-30 15:20:10.334  INFO 7612 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.16
2017-07-30 15:20:10.472  INFO 7612 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-07-30 15:20:10.472  INFO 7612 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2398 ms
2017-07-30 15:20:10.788  INFO 7612 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-07-30 15:20:10.792  INFO 7612 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-07-30 15:20:10.792  INFO 7612 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-07-30 15:20:10.793  INFO 7612 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-07-30 15:20:10.793  INFO 7612 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-07-30 15:20:11.221  INFO 7612 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot[email protected]3bd94634: startup date [Sun Jul 30 15:20:08 IST 2017]; root of context hierarchy
2017-07-30 15:20:11.299  INFO 7612 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/welcome]}" onto public java.lang.String com.template.controller.TestController.hello(org.springframework.ui.Model,java.lang.String)
2017-07-30 15:20:11.302  INFO 7612 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-07-30 15:20:11.302  INFO 7612 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-07-30 15:20:11.337  INFO 7612 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-07-30 15:20:11.337  INFO 7612 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-07-30 15:20:11.374  INFO 7612 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-07-30 15:20:11.626  INFO 7612 --- [           main] o.s.w.s.v.f.FreeMarkerConfigurer         : ClassTemplateLoader for Spring macros added to FreeMarker configuration
2017-07-30 15:20:11.727  INFO 7612 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-07-30 15:20:11.790  INFO 7612 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-07-30 15:20:11.795  INFO 7612 --- [           main] c.t.SpringBootFreemarkerApplication      : Started SpringBootFreemarkerApplication in 4.222 seconds (JVM running for 5.046)

Your controller is not scanned by the default component scan that Spring Boot provides. By default Spring boot starts from the package that contains the “main” class – the one annotated with @SpringBootApplication and also scans all of it’s sub packages.

Your main class is in package com.template; but the controller is in package controller;. Move the controller in a package named package com.template.controller;

Since you are using FreeMarker Template with spring boot, I would suggest you to move your welcome.ftl template from this location src/webapp/welcome.ftl to this src/main/resources/templates/welcome.ftl and then restart your application and hit http://localhost:8080/welcome