com.github.carlopantaleo.jmodel.HelloApplication Maven / Gradle / Ivy
package com.github.carlopantaleo.jmodel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import java.util.Arrays;
@SpringBootApplication
public class HelloApplication {
private static final Logger log = LoggerFactory.getLogger(HelloApplication.class);
public static void main(String[] args) {
SpringApplication.run(HelloApplication.class, args);
}
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
return args -> {
log.info("Application running under Spring Boot with the following dependencies:");
String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
log.info(beanName);
}
};
}
}