Access the full course here: javabrains.io/courses/spring_bootquickstart
Learn how to create a new REST endpoint by creating a brand new Spring MVC controller.
33 Comments on "Spring Boot Quick Start 11 – Adding a REST Controller"
@springbootapplication @ComponentScan(basePackages = "<basepackage>) Without this annotation the example does not work. Please add this to your video. ….. other solution to omit this annotation is to keep application class in a root packageabove other classes as mentioned in springboot documentation here docs.spring.io/spring-boot/docs/current/reference/html/using-boot-structuring-your-code.html
Hello, I have used jackson object mapper to convert JSON into a java object. But I want to to show this object in my browser. How should i do it ?
Description Resource Path Location TypeArchive for required library: 'C:/Users/HP/.m2/repository/org/hibernate/hibernate-validator/5.2.4.Final/hibernate-validator-5.2.4.Final.jar' in project 'course-api' cannot be read or is not a valid ZIP file course-api Build path Build Path ProblemSir please may i known how to resolve this problem
If some one have the same error as me "The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured." This is a port conflict , my programm is still running and I tried to run it again.Always normally terminate your "run" red buttone closed to "console" then rerun your project! It have to help
Kaushik, a bit off topic question. whats the keyboard that you are using. love the sound of the keypress.
@RequestMapping is not working on for me. Tomcat started successfully but not able to see any response on browser.
@springbootapplication @ComponentScan(basePackages = "<basepackage>) Without this annotation the example does not work. Other solution to omit this annotation is to keep application class in a root packageabove other classes as mentioned in springboot documentation here docs.spring.io/spring-boot/docs/current/reference/html/using-boot-structuring-your-code.html
You're the real MVP
add this under @springbootapplication @ComponentScan(basePackages = "<basepackage>)basepackage should be the package which you have your Restcontroller.
same issue here, if i can fix it up, i will post it
Hi, Kaushik I am just wondering how the view resolver worked here? Does Spring boot sets default view resolver?
Same problem to me. Please give me a solution if you solved the issue
For those whom it worked .. How did this work without adding @ComponentScan("io.javabrains")? At least, it didn't work until I added that 🙁
Hi Kaushik, Thanks for this wonderful tutorial. I can't see the tomcat running in my console. Can u help me ??
that works like a charm…..
In your ApplicationStarter(where you have added SpringBootApplication annotation) class add @ComponentScan(basePackages = "<basepackage>"), in place of <basepackage> put package of TestController or put a parent package so that everything is scanned..after that it should work..
Angshuman Dey try to change the port number and start again!
Thanks Worked like a gem 🙂
Try to create the "Application.properties" file in src/main/resources and add try to change you embedded tomcat server port by adding these lines into the Application.properties file: 1. logging.level.org.springframework: DEBUG2. server.port=8282Run again your project and try: localhost:8282/hello. Hope I helped!
In CodeChannels.com, you can learn to code by watching videos and stay up to date with latest code shows, events and tutorials aggregated from various leading developer communities.
Copyright 2016 By CodeChannels.com All rights reserved.