Reputation: 11
I'm facing a peculiar issue with accessing endpoints in my Spring Boot application after separating the CarController class into its own file. Initially, all controllers were defined within a single class (ProductController), and I could access their endpoints without any issues. However, after separating the CarController class into a separate file, I'm unable to access its endpoints. The error says:
There was an unexpected error (type=Not Found, status=404). No static resource car/listCar.
In this setup, I can access endpoints defined in ProductController, but not in CarController. Interestingly, I've also separated the HomePageController into its own file, and it works perfectly fine.
I've ensured that all dependencies are correctly injected, and there are no compilation errors. Could someone please help me understand why I'm unable to access endpoints in CarController after separating it into its own file, while endpoints in other controllers work as expected?
ProductController.java:
// ProductController.java
package com.example.controller;
// Imports and annotations...
@Controller
@RequestMapping("/product")
public class ProductController {
// Endpoint mappings for product-related operations...
}
CarController.java:
// CarController.java
package com.example.controller;
// Imports and annotations...
@Controller
@RequestMapping("/car")
public class CarController {
// Endpoint mappings for car-related operations...
}
Upvotes: 0
Views: 19