commandlineRunner

@SpringBootApplication
asf4j
public class DataSourceDemoApplication implements CommandLineRunner (@Autowiredprivate DataSource dataSource;
public static void main(String[] args) {
SpringApplication.run(DataSourceDemoApplication.class,args);
@Override
public void run(String... args) throws Exception {log.info(dataSource.toString());
Connection conn = dataSource.getConnection();log.info(conn.toString());conn.close();

 

 

posted @ 2023-12-28 08:54  CharyGao  阅读(2)  评论(0编辑  收藏  举报