Bhargav Netha
Bhargav Netha

Reputation: 87

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

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

Answers (1)

Arghya Sadhu
Arghya Sadhu

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

Related Questions