Leave a Reply

34 Comments on "Spring Boot Quick Start 11 – Adding a REST Controller"

Notify of
avatar

Kaushik Lele
Guest
Kaushik Lele
1 month 4 days ago

@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

golokesh patra
Guest
golokesh patra
1 month 9 days ago

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 ?

Sugam Shende
Guest
Sugam Shende
2 months 4 days ago

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

Marinakulichok
Guest
Marinakulichok
2 months 5 days ago

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

krishna chaitanya
Guest
krishna chaitanya
2 months 7 days ago

Kaushik, a bit off topic question. whats the keyboard that you are using. love the sound of the keypress.

Ashutosh Sharma
Guest
Ashutosh Sharma
3 months 16 days ago

@RequestMapping is not working on for me. Tomcat started successfully but not able to see any response on browser.

Kaushik Lele
Guest
Kaushik Lele
1 month 4 days ago

@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

Anand Bharti
Guest
Anand Bharti
1 month 7 days ago

Thanks alot

Chris Jacobs
Guest
Chris Jacobs
1 month 10 days ago

You're the real MVP

Emre Verim
Guest
Emre Verim
3 months 6 days ago

add this under @springbootapplication @ComponentScan(basePackages = "<basepackage>)basepackage should be the package which you have your Restcontroller.

Emre Verim
Guest
Emre Verim
3 months 6 days ago

same issue here, if i can fix it up, i will post it

Angshuman Dey
Guest
Angshuman Dey
3 months 22 days ago

Hi, Kaushik I am just wondering how the view resolver worked here? Does Spring boot sets default view resolver?

Uttam Patra
Guest
Uttam Patra
3 months 23 days ago
Hi kaushik, I am not able to see tomcat in the console2017-03-30 13:41:51.059 INFO 14820 — [ main] com.ukp.springbootstarter.CourseApiApp : Starting CourseApiApp on BDC4A-L-6440LBB with PID 14820 (C:uttamMyDemosSpringBootws1course-apitargetclasses started by uttam.patra.kumar in C:uttamMyDemosSpringBootws1course-api)2017-03-30 13:41:51.066 INFO 14820 — [ main] com.ukp.springbootstarter.CourseApiApp : No active profile set, falling back to default profiles: default2017-03-30 13:41:51.212 INFO 14820 — [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@769f71a9: startup date [Thu Mar 30 13:41:51 IST 2017]; root of context hierarchy2017-03-30 13:41:55.404 INFO 14820 — [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup2017-03-30 13:41:55.649 INFO 14820 — [ main] com.ukp.springbootstarter.CourseApiApp : Started CourseApiApp in 5.666… Read more »
Shyam Rao Singham
Guest
Shyam Rao Singham
3 months 17 days ago

Same problem to me. Please give me a solution if you solved the issue

bbvkishore
Guest
bbvkishore
3 months 25 days ago

For those whom it worked .. How did this work without adding @ComponentScan("io.javabrains")? At least, it didn't work until I added that 🙁

sumanth varada
Guest
sumanth varada
4 months 18 days ago

Hi Kaushik, Thanks for this wonderful tutorial. I can't see the tomcat running in my console. Can u help me ??

Angshuman Dey
Guest
Angshuman Dey
3 months 14 days ago

that works like a charm…..

Ekta Dubey
Guest
Ekta Dubey
3 months 15 days ago

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
Guest
Angshuman Dey
3 months 18 days ago
Hi Vaibhav,Did that but no success. Same thing is happening. Don't know what's wrong with my code it's really very frustrating.localhost:8282/firstTestController class—————————-@RestControllerpublic class TestController { @RequestMapping("/firstTest") public String springBootFirstTest(){ return "THIS IS MY FIRST SPRING BOOT APPLICATION"; }}Log output———————2017-04-05 12:53:09.389 DEBUG 5320 — [nio-8282-exec-1] o.s.web.servlet.DispatcherServlet : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/firstTest]2017-04-05 12:53:09.392 DEBUG 5320 — [nio-8282-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /firstTest2017-04-05 12:53:09.396 DEBUG 5320 — [nio-8282-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Did not find handler method for [/firstTest]2017-04-05 12:53:09.396 DEBUG 5320 — [nio-8282-exec-1] o.s.w.s.handler.SimpleUrlHandlerMapping : Matching patterns for request [/firstTest] are [/**]2017-04-05 12:53:09.397 DEBUG 5320… Read more »
G. VAIBHAV REDDY
Guest
G. VAIBHAV REDDY
3 months 19 days ago

Angshuman Dey try to change the port number and start again!

Angshuman Dey
Guest
Angshuman Dey
3 months 19 days ago
Hi Lionel, I can see my tomcat is running. But still getting the White Label error page by default for the url.localhost:8080/hello. Can you help me with that?My eclipse console output is as below2017-04-04 17:06:53.066 INFO 7092 — [ main] com.ad.springboot.app.CourseApiApp : Starting CourseApiApp on angsdey2 with PID 7092 (C:personalSTS-WorkspaceSpring-Bootcourse-apitargetclasses started by ibm in C:personalSTS-WorkspaceSpring-Bootcourse-api)2017-04-04 17:06:53.069 INFO 7092 — [ main] com.ad.springboot.app.CourseApiApp : No active profile set, falling back to default profiles: default2017-04-04 17:06:53.132 INFO 7092 — [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1de60b4: startup date [Tue Apr 04 17:06:53 IST 2017]; root of context hierarchy2017-04-04 17:06:55.138 INFO 7092 — [… Read more »
G. VAIBHAV REDDY
Guest
G. VAIBHAV REDDY
3 months 21 days ago

Thanks Worked like a gem 🙂

Lionel Kamdem
Guest
Lionel Kamdem
4 months 8 days ago

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!

wpDiscuz