Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here are some steps that can be taken to fix the RestController's debug point in the Spring Boot Test:

  1. Make sure that the RestController is scanned and registered in the Spring Boot Application. Check if the controller is included in the @ComponentScan or @SpringBootApplication annotations.

  2. Check if the @RequestMapping annotation of the RestController is correctly mapped. The URL should match with the value specified in the annotation.

  3. Ensure that the test class is annotated with @SpringBootTest and @AutoConfigureMockMvc. This will start the Spring context and enable the MockMvc instance for testing.

  4. Verify if the request URL in the test case matches with the RestController's request mapping URL. Use the MockMvc instance to send the request to the endpoint.

  5. Check if any exceptions are thrown in the RestController code. If there are any errors or exceptions, it may not hit the debug point. Fixing the error can resolve the issue.

  6. If the RestController is still not hitting the debug point, enable the debug logs for Spring Boot. You can add logging.level.org.springframework=DEBUG in the application.properties file. This will provide detailed logs and help to troubleshoot the issue.

  7. If all the above steps fail, try using a different IDE or trying to debug in command-line mode. Sometimes, IDEs may not work well with Spring Boot Test debugging.