1 package net.sumaris.server.config;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import org.nuiton.i18n.I18n;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
28 import org.springframework.beans.factory.annotation.Autowired;
29 import org.springframework.beans.factory.annotation.Value;
30 import org.springframework.boot.context.event.ApplicationReadyEvent;
31 import org.springframework.context.ApplicationListener;
32 import org.springframework.stereotype.Component;
33
34 @Component
35 public class ApplicationStartupListener implements ApplicationListener<ApplicationReadyEvent> {
36 private static final Logger log = LoggerFactory.getLogger(ApplicationStartupListener.class);
37
38 private final String port;
39
40 @Autowired
41 public ApplicationStartupListener(@Value("${server.port}") String port) {
42 this.port = port;
43 }
44
45 @Override
46 public void onApplicationEvent(final ApplicationReadyEvent event) {
47 log.info(I18n.t("sumaris.server.started", this.port));
48 }
49 }