October 24, 2024
Chicago 12, Melborne City, USA
java

Add prefix to some java spring boot controllers


Is there a way to add a prefix to a group od controllers leaving the rest of the controllers out of this prefix
example:

@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping(value = "/families")
@RolesGuard(role = {Roles.Manager, Roles.Employee})
public class MyController {
    ...
}

I already added the global prefix for the whole app using context-path but I want a custom prefix for this controller and the other controllers of same package without affecting the rest of the controllers without adding @RequestMapping(value = "/prefix/families") for example for every controller knowing that my controllers are grouped according to their functionality into several package (products, suppliers, …)



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video