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;
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
add a comment |
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
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
add a comment |
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
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
java spring spring-boot spring-mvc thymeleaf
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
make sure spring-boot-starter-thymeleaf is included as dependencies of the project.
this guide may help
How can I missed that ... Thanks a lot!
– N. Lamblin
Mar 8 at 14:34
add a comment |
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
make sure spring-boot-starter-thymeleaf is included as dependencies of the project.
this guide may help
How can I missed that ... Thanks a lot!
– N. Lamblin
Mar 8 at 14:34
add a comment |
make sure spring-boot-starter-thymeleaf is included as dependencies of the project.
this guide may help
How can I missed that ... Thanks a lot!
– N. Lamblin
Mar 8 at 14:34
add a comment |
make sure spring-boot-starter-thymeleaf is included as dependencies of the project.
this guide may help
make sure spring-boot-starter-thymeleaf is included as dependencies of the project.
this guide may help
answered Mar 8 at 14:02
addinsaddins
414
414
How can I missed that ... Thanks a lot!
– N. Lamblin
Mar 8 at 14:34
add a comment |
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
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Mar 8 at 15:00
AlexanderAlexander
335
335
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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