I have shell script which is simply building and deploying my spring boot app.
Within this script I have only 1 command:
mvn spring-boot:run
Is it possible to print URL under which my app was deployed after deployment is successfully finished? The best would be if I can obtain this URL somehow and print it on the console.
EDIT I used following solution
@Component
public class ListenerContainer {
@Autowired
Environment environment;
private Logger logger = LoggerFactory.getLogger(ListenerContainer.class);
@EventListener(ApplicationReadyEvent.class)
public void postStartupPrint() throws UnknownHostException {
logger.info("Application deployed under: http://"
+ InetAddress.getLocalHost().getHostAddress()
+ ":"
+ environment.getProperty("local.server.port"));
}
}