Java Spring Basics Creating Controllers and Views Create a Controller to Handle HTTP Requests

WhiteLabel Error Page is coming

build.gradle plugins { id 'java' id 'idea' id 'eclipse' id 'org.springframework.boot' version '2.1.4.RELEASE' id "io.spring.dependency-management" version "1.0.7.RELEASE"

} group 'com.teamtreehouse' version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories { mavenCentral() }

dependencies { compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf', version: '2.1.4.RELEASE' compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.1.4.RELEASE' }

AppConfig.java package com.teamtreehouse.giflib;

import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan;

@EnableAutoConfiguration @ComponentScan public class AppConfig { public static void main(String[] args){ //this method is from string boot library to run our application SpringApplication.run(AppConfig.class, args); } }

GifController.java package controller;

import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;

@Controller public class GifController { @RequestMapping("/") @ResponseBody public String listGifs(){ return "List of all GIFs !"; }

}

application.properties server.port = 9999

Daniel Turato
Daniel Turato
Java Web Development Techdegree Graduate 30,101 Points

Could you reformat your code and explain more in detail about your problem please? I may be able to help you more if you do those things