1 package dst.ass2.service.auth;
3 import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory;
5 import org.springframework.boot.CommandLineRunner;
6 import org.springframework.context.ApplicationContext;
7 import org.springframework.context.ApplicationContextAware;
9 import dst.ass2.service.auth.grpc.IGrpcServerRunner;
12 * This class loads the {@link IGrpcServerRunner} from the application context and runs it after the application starts.
14 public class SpringGrpcServerRunner implements CommandLineRunner, ApplicationContextAware {
16 private static final Logger LOG = LoggerFactory.getLogger(SpringGrpcServerRunner.class);
18 private ApplicationContext applicationContext;
21 public void setApplicationContext(ApplicationContext applicationContext) {
22 this.applicationContext = applicationContext;
26 public void run(String... args) throws Exception {
27 LOG.info("Getting instance of GrpcServerRunner");
28 IGrpcServerRunner bean = applicationContext.getBean(IGrpcServerRunner.class);
29 LOG.info("Starting IGrpcServerRunner instance {}", bean);