• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Trying to run Simple GET Rest Springboot application

 
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting started with Spring boot (STS 4) and following this tutorial on my Eclipse 2018-19 version.


https://dzone.com/articles/spring-boot-restful-web-service-example

I ran the following command which is mentioned in the above tutorial :

java -jar target\spring-boot-rest-0.0.1-SNAPSHOT.jar and got the following screen, (Started SpringBootRestApplication in 6236 seconds )



My Questions:

1) Do I always need to go to the folder manually and then start it like they way it is mentioned in the above tutorial?

2) Can I set this up in eclipse only so that I won't have to do it using command line? I configured Apache Tomcat on my Eclipse and when I right clicked and clicked on "Add/Remove..", I got the message window saying " There are no resources that can be added or removed from the server". So, even if I plan to
set this up in eclipse, how should I proceed?

3) As suggested in the tutorial above, I tried accessing the URL in the following manner on my browser :

http://localhost:8083/welcome/user

But, I keep getting error :

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

Thu Oct 04 12:19:41 CDT 2018
There was an unexpected error (type=Not Found, status=404).
No message available




 
Bartender
Posts: 207
14
Mac OS X IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a very limited knowledge of Spring but I think that when using Spring Boot the server is already embedded in the app so you should not try to start another instance from the IDE (somebody correct me if I'm wrong). You should be able to start your app just by clicking "Run" button. Regarding the 404 error - check your WelcomeController, see if the @GetMapping annotation is not missing.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can run the @SpringBootApplication class as a regular Java class. Some IDEs will treat it specially as a Spring Boot application, others will treat it as any other Java class.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic