sources: journaldev-RestTemplate
Spring's RestTemplate class, part of spring-web project was introduced in spring-3. It reduces boilerplate and eases making http calls.
Basic folder structure:
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── org_name
│ │ │ └── jmx_test
│ │ │ ├── Application.java
│ │ │ ├── components
│ │ │ │ └── Hello.java
│ │ │ └── controllers
│ │ │ └── errors
│ │ ├── resources
│ │ │ └── application.properties
│ │ └── webapp
│ │ ├── errors
│ │ │ └── notfound.html
│ │ └── index.html
│ └── test
# How to configure embedded-web-server's port for spring-boot web applications?
OR,
@Bean
public ConfigurableServletWebServerFactory webServerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
factory.setPort(9999);
// factory.setContextPath("/jmx-test");
factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/errors/notfound.html"));
return factory;
}