java - Spring boot whitelabel 404 -


hello guys keep getting error though have followed spring tutorial website. have been trying figure out why i'm getting error. able connect facebook when trying retrieve feeds tutorial provided spring, keep getting whitelabel error. says:

this application has no explicit mapping /error, seeing fallback. there unexpected error (type=not found, status=404). no message available

everything seems okay dont know why keep getting error. if can assist appreciate it.

my controller placed in src/main/java/home:

@controller @requestmapping(value="/") public class homecontroller {  private facebook facebook;  @inject public homecontroller(facebook facebook) {     this.facebook = facebook; }  @requestmapping( method =requestmethod.get) public string getphotos(model model){      if(!facebook.isauthorized())     {         return "redirect:/connect/facebook";     }     model.addattribute(facebook.useroperations().getuserprofile());     pagedlist<post> homefeed = facebook.feedoperations().gethomefeed();     model.addattribute("feed", homefeed);      return "hello";  } } 

application.java file placed in src/main/java/home/main:

@springbootapplication  public class application {  public static void main(string[] args) {     springapplication.run(application.class, args);   } } 

below build.gradle file:

apply plugin: 'java' apply plugin: 'idea' apply plugin: 'spring-boot'  buildscript{ repositories{    // maven { url "https://repo.spring.io/release" }     maven { url "https://repo.spring.io/libs-milestone"}    // mavencentral()       } dependencies {     classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.3.release")   }  } repositories {    maven { url "https://repo.spring.io/libs-milestone"}    mavencentral()  } bootrepackage {   mainclass = 'facebookarchiver.application' }  dependencies {   compile ('org.springframework.social:spring-social-facebook:2.0.0.release')   compile("org.springframework.boot:spring-boot-starter-thymeleaf")   compile('org.springframework.boot:spring-boot-starter-web')   testcompile group: 'junit', name: 'junit', version: '4.11'  }  task wrapper(type: wrapper) {       gradleversion = '2.3'  } 

hello.html file: it's saved in src/main/resources/templates folder:

<html>  <head> <title>hello facebook</title> </head> <body>  <h3>hello, <span th:text="${facebookprofile.name}">some user</span>!</h3>   <h4>here home feed:</h4>   <div th:each="post:${feed}">  <b th:text="${post.from.name}">from</b> wrote:  <p th:text="${post.message}">message text</p>  <img th:if="${post.picture}" th:src="${post.picture}"/>  <hr/>  </div> </body> </html> 

facebookconnect.html: it's stored under src/main/resources/templates/connect folder:

 <html>  <head>  <title>hello facebook</title>  </head>  <body>   <h3>connect facebook</h3>    <form action="/connect/facebook" method="post"> <input type="hidden" name="scope" value="read_stream" />   <div class="forminfo">     <p>you aren't connected facebook yet. click button connect  application facebook account.</p>  </div>  <p><button type="submit">connect facebook</button></p> </form> </body> </html> 

and facebookconnected.html: stored under src/main/resources/templates/connect folder: below file facebookconnected.html:

<html> <head>   <title>hello facebook</title> </head>   <body>    <h3>connected facebook</h3>    <p>      connected facebook account.     click <a href="/">here</a> see entries facebook photos.   </p> </body> </html> 

if controllers in different package structure, @componentscan needs added spring boot application class.

example :

@componentscan(basepackages={"package name of controller is"}) 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -