Reputation: 87
enter image description hereThis is my Controller, I'm accessing with port localhost:8080 it is returning white label error. What may be the reason?
@RestController
public class EmployeeController {
@GetMapping("/")
public String hello() {
return "service is up and running";
}
Upvotes: 2
Views: 24889
Reputation: 44569
The issue is related to your project structure, by default Spring Boot will scan the components below your main application class.
In your case your main is located at package com.navajna.aaa
, and your controller is located at package com.navajna.controller
.
I would recommend you to keep your controller in a new package below the com.navajna.aaa
package, like com.navajna.aaa.controller
as per structure mentioned in the documentation.
If you really want to use the com.navajna.controller
package, you may need to add the @ComponentScan("com.navajna.controller")
.Details here.
Upvotes: 6