How to configure Spring / Springboot to access the home page? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceHow does autowiring work in Spring?How do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?How to respond with HTTP 400 error in a Spring MVC @ResponseBody method returning String?How to configure port for a Spring Boot applicationHow to log SQL statements in Spring Boot?Configuring RequestContextListener in SpringBootSpring Boot Configure and Use Two DataSources(Spring, Thymeleaf) How to request to controller 'POST' with list of model inside a model?Spring Boot - There was an unexpected error (type=Bad Request, status=400). Required request body is missingSpring - @Deletemapping

Do working physicists consider Newtonian mechanics to be "falsified"?

Can the prologue be the backstory of your main character?

Derivation tree not rendering

Why not take a picture of a closer black hole?

ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?

Why can't devices on different VLANs, but on the same subnet, communicate?

He got a vote 80% that of Emmanuel Macron’s

Segmentation fault output is suppressed when piping stdin into a function. Why?

What is special about square numbers here?

Take groceries in checked luggage

How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time

Are spiders unable to hurt humans, especially very small spiders?

Can smartphones with the same camera sensor have different image quality?

Why can't wing-mounted spoilers be used to steepen approaches?

"... to apply for a visa" or "... and applied for a visa"?

Difference between "generating set" and free product?

Scientific Reports - Significant Figures

In horse breeding, what is the female equivalent of putting a horse out "to stud"?

Simulating Exploding Dice

How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?

How can I protect witches in combat who wear limited clothing?

Can a 1st-level character have an ability score above 18?

Keeping a retro style to sci-fi spaceships?

Would an alien lifeform be able to achieve space travel if lacking in vision?



How to configure Spring / Springboot to access the home page?



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceHow does autowiring work in Spring?How do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?How to respond with HTTP 400 error in a Spring MVC @ResponseBody method returning String?How to configure port for a Spring Boot applicationHow to log SQL statements in Spring Boot?Configuring RequestContextListener in SpringBootSpring Boot Configure and Use Two DataSources(Spring, Thymeleaf) How to request to controller 'POST' with list of model inside a model?Spring Boot - There was an unexpected error (type=Bad Request, status=400). Required request body is missingSpring - @Deletemapping



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I'm trying to build my first web app with Springboot (JPA, H2) and Thymeleaf.



My goal is to get / modify / delete data stored into a database (entities/) through controllers (controllers/).



However, the home route doesn't work.



Can you tell me and explain me what I did wrong? I forget to configure something?



Thanks for help!



Error



URL : localhost:8082/



Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Mar 08 14:22:21 CET 2019
There was an unexpected error (type=Not Found, status=404).
No message available


IndexController



@RestController
@RequestMapping("/")
public class IndexController

@GetMapping(value = "/")
public ModelAndView getHome()
ModelAndView mv = new ModelAndView();
mv.setViewName("index");
return mv;




index.html



<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Home</title>
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
</head>
<body>
<p>Test</p>
</body>
</html>


Folders



projetname/
|__src/
|__main/
|__java/
|__projectname/
| |__controllers/
| | |__IndexController.java
| |__entities/
| |__repositories/
| |__App.java
|__resources/
|__static/
| |__css/
| |__js/
|__templates/
| |__index.html
|__data.sql
|__application.properties









share|improve this question



















  • 1





    follow this, and you'll have a working service in a matter of minutes: spring.io/guides/gs/rest-service

    – Stultuske
    Mar 8 at 13:32











  • @RequestMapping of / on both the controller and the method might be the problem. That'll map to //. You can remove the class-level one.

    – Michael
    Mar 8 at 13:36












  • @Stultuske I already tried to follow this doc.

    – N. Lamblin
    Mar 8 at 13:40











  • @Michael even if I remove @RequestMapping("/") I still have the problem.

    – N. Lamblin
    Mar 8 at 13:41


















1















I'm trying to build my first web app with Springboot (JPA, H2) and Thymeleaf.



My goal is to get / modify / delete data stored into a database (entities/) through controllers (controllers/).



However, the home route doesn't work.



Can you tell me and explain me what I did wrong? I forget to configure something?



Thanks for help!



Error



URL : localhost:8082/



Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Mar 08 14:22:21 CET 2019
There was an unexpected error (type=Not Found, status=404).
No message available


IndexController



@RestController
@RequestMapping("/")
public class IndexController

@GetMapping(value = "/")
public ModelAndView getHome()
ModelAndView mv = new ModelAndView();
mv.setViewName("index");
return mv;




index.html



<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Home</title>
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
</head>
<body>
<p>Test</p>
</body>
</html>


Folders



projetname/
|__src/
|__main/
|__java/
|__projectname/
| |__controllers/
| | |__IndexController.java
| |__entities/
| |__repositories/
| |__App.java
|__resources/
|__static/
| |__css/
| |__js/
|__templates/
| |__index.html
|__data.sql
|__application.properties









share|improve this question



















  • 1





    follow this, and you'll have a working service in a matter of minutes: spring.io/guides/gs/rest-service

    – Stultuske
    Mar 8 at 13:32











  • @RequestMapping of / on both the controller and the method might be the problem. That'll map to //. You can remove the class-level one.

    – Michael
    Mar 8 at 13:36












  • @Stultuske I already tried to follow this doc.

    – N. Lamblin
    Mar 8 at 13:40











  • @Michael even if I remove @RequestMapping("/") I still have the problem.

    – N. Lamblin
    Mar 8 at 13:41














1












1








1








I'm trying to build my first web app with Springboot (JPA, H2) and Thymeleaf.



My goal is to get / modify / delete data stored into a database (entities/) through controllers (controllers/).



However, the home route doesn't work.



Can you tell me and explain me what I did wrong? I forget to configure something?



Thanks for help!



Error



URL : localhost:8082/



Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Mar 08 14:22:21 CET 2019
There was an unexpected error (type=Not Found, status=404).
No message available


IndexController



@RestController
@RequestMapping("/")
public class IndexController

@GetMapping(value = "/")
public ModelAndView getHome()
ModelAndView mv = new ModelAndView();
mv.setViewName("index");
return mv;




index.html



<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Home</title>
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
</head>
<body>
<p>Test</p>
</body>
</html>


Folders



projetname/
|__src/
|__main/
|__java/
|__projectname/
| |__controllers/
| | |__IndexController.java
| |__entities/
| |__repositories/
| |__App.java
|__resources/
|__static/
| |__css/
| |__js/
|__templates/
| |__index.html
|__data.sql
|__application.properties









share|improve this question
















I'm trying to build my first web app with Springboot (JPA, H2) and Thymeleaf.



My goal is to get / modify / delete data stored into a database (entities/) through controllers (controllers/).



However, the home route doesn't work.



Can you tell me and explain me what I did wrong? I forget to configure something?



Thanks for help!



Error



URL : localhost:8082/



Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Mar 08 14:22:21 CET 2019
There was an unexpected error (type=Not Found, status=404).
No message available


IndexController



@RestController
@RequestMapping("/")
public class IndexController

@GetMapping(value = "/")
public ModelAndView getHome()
ModelAndView mv = new ModelAndView();
mv.setViewName("index");
return mv;




index.html



<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Home</title>
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
</head>
<body>
<p>Test</p>
</body>
</html>


Folders



projetname/
|__src/
|__main/
|__java/
|__projectname/
| |__controllers/
| | |__IndexController.java
| |__entities/
| |__repositories/
| |__App.java
|__resources/
|__static/
| |__css/
| |__js/
|__templates/
| |__index.html
|__data.sql
|__application.properties






java spring spring-boot spring-mvc thymeleaf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 13:44







N. Lamblin

















asked Mar 8 at 13:31









N. LamblinN. Lamblin

363115




363115







  • 1





    follow this, and you'll have a working service in a matter of minutes: spring.io/guides/gs/rest-service

    – Stultuske
    Mar 8 at 13:32











  • @RequestMapping of / on both the controller and the method might be the problem. That'll map to //. You can remove the class-level one.

    – Michael
    Mar 8 at 13:36












  • @Stultuske I already tried to follow this doc.

    – N. Lamblin
    Mar 8 at 13:40











  • @Michael even if I remove @RequestMapping("/") I still have the problem.

    – N. Lamblin
    Mar 8 at 13:41













  • 1





    follow this, and you'll have a working service in a matter of minutes: spring.io/guides/gs/rest-service

    – Stultuske
    Mar 8 at 13:32











  • @RequestMapping of / on both the controller and the method might be the problem. That'll map to //. You can remove the class-level one.

    – Michael
    Mar 8 at 13:36












  • @Stultuske I already tried to follow this doc.

    – N. Lamblin
    Mar 8 at 13:40











  • @Michael even if I remove @RequestMapping("/") I still have the problem.

    – N. Lamblin
    Mar 8 at 13:41








1




1





follow this, and you'll have a working service in a matter of minutes: spring.io/guides/gs/rest-service

– Stultuske
Mar 8 at 13:32





follow this, and you'll have a working service in a matter of minutes: spring.io/guides/gs/rest-service

– Stultuske
Mar 8 at 13:32













@RequestMapping of / on both the controller and the method might be the problem. That'll map to //. You can remove the class-level one.

– Michael
Mar 8 at 13:36






@RequestMapping of / on both the controller and the method might be the problem. That'll map to //. You can remove the class-level one.

– Michael
Mar 8 at 13:36














@Stultuske I already tried to follow this doc.

– N. Lamblin
Mar 8 at 13:40





@Stultuske I already tried to follow this doc.

– N. Lamblin
Mar 8 at 13:40













@Michael even if I remove @RequestMapping("/") I still have the problem.

– N. Lamblin
Mar 8 at 13:41






@Michael even if I remove @RequestMapping("/") I still have the problem.

– N. Lamblin
Mar 8 at 13:41













2 Answers
2






active

oldest

votes


















1














make sure spring-boot-starter-thymeleaf is included as dependencies of the project.



this guide may help






share|improve this answer























  • How can I missed that ... Thanks a lot!

    – N. Lamblin
    Mar 8 at 14:34


















0














When application started look at it's log and find mappings like



2019-03-08 17:52:24.864 INFO 9592 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "[/greeting]" onto public hello.Greeting hello.GreetingController.greeting(java.lang.String)



This means you can call URL with /greeting and it is mapped to correspondent controller



404 error means you call URL that is not mapped






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55064267%2fhow-to-configure-spring-springboot-to-access-the-home-page%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    make sure spring-boot-starter-thymeleaf is included as dependencies of the project.



    this guide may help






    share|improve this answer























    • How can I missed that ... Thanks a lot!

      – N. Lamblin
      Mar 8 at 14:34















    1














    make sure spring-boot-starter-thymeleaf is included as dependencies of the project.



    this guide may help






    share|improve this answer























    • How can I missed that ... Thanks a lot!

      – N. Lamblin
      Mar 8 at 14:34













    1












    1








    1







    make sure spring-boot-starter-thymeleaf is included as dependencies of the project.



    this guide may help






    share|improve this answer













    make sure spring-boot-starter-thymeleaf is included as dependencies of the project.



    this guide may help







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 8 at 14:02









    addinsaddins

    414




    414












    • How can I missed that ... Thanks a lot!

      – N. Lamblin
      Mar 8 at 14:34

















    • How can I missed that ... Thanks a lot!

      – N. Lamblin
      Mar 8 at 14:34
















    How can I missed that ... Thanks a lot!

    – N. Lamblin
    Mar 8 at 14:34





    How can I missed that ... Thanks a lot!

    – N. Lamblin
    Mar 8 at 14:34













    0














    When application started look at it's log and find mappings like



    2019-03-08 17:52:24.864 INFO 9592 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "[/greeting]" onto public hello.Greeting hello.GreetingController.greeting(java.lang.String)



    This means you can call URL with /greeting and it is mapped to correspondent controller



    404 error means you call URL that is not mapped






    share|improve this answer



























      0














      When application started look at it's log and find mappings like



      2019-03-08 17:52:24.864 INFO 9592 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "[/greeting]" onto public hello.Greeting hello.GreetingController.greeting(java.lang.String)



      This means you can call URL with /greeting and it is mapped to correspondent controller



      404 error means you call URL that is not mapped






      share|improve this answer

























        0












        0








        0







        When application started look at it's log and find mappings like



        2019-03-08 17:52:24.864 INFO 9592 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "[/greeting]" onto public hello.Greeting hello.GreetingController.greeting(java.lang.String)



        This means you can call URL with /greeting and it is mapped to correspondent controller



        404 error means you call URL that is not mapped






        share|improve this answer













        When application started look at it's log and find mappings like



        2019-03-08 17:52:24.864 INFO 9592 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "[/greeting]" onto public hello.Greeting hello.GreetingController.greeting(java.lang.String)



        This means you can call URL with /greeting and it is mapped to correspondent controller



        404 error means you call URL that is not mapped







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 8 at 15:00









        AlexanderAlexander

        335




        335



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55064267%2fhow-to-configure-spring-springboot-to-access-the-home-page%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

            Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

            Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved