To set the context path of a Spring Boot application, you can use the server.servlet.context-path property in the application.properties file.
For example, if you want to set the context path to /myapp, you can add the following line to your application.properties file:
server.servlet.context-path=/myapp
Alternatively, you can set the context path programmatically using the setDefaultContextPath() method of the SpringApplication class.
import org.springframework.boot.SpringApplication;
// ...
SpringApplication app = new SpringApplication(MyApplication.class);
app.setDefaultContextPath("/myapp");
app.run();
This will set the context path of the application to /myapp.