We have a spring boot based application and using spring webflux, we are exposing 3 ports
- server.port
- management.server.port (actuator) and are planning to expose another port called as admin port.
We want to expose a specific REST controller on this admin port which will be private. This api will provide all the admin level configuration and will not be available publicly to the user.
Note: We don't want to expose api on actuator port. Need to open a new port.
Using the following code to open a new port by starting a new server instance.
@Configuration
public class NettyServerForAdminPort {
@Value("${admin.port}")
private Integer adminPort;
@Autowired
HttpHandler httpHandler;
WebServer http;
@PostConstruct
public void start() {
ReactiveWebServerFactory factory = new NettyReactiveWebServerFactory(8081);
this.http = factory.getWebServer(this.httpHandler);
this.http.start();
}
@PreDestroy
public void stop() {
this.http.stop();
}
}
Any insights on how this can be achieved?