spring相关

Java 未结 1 113
网络营销博客
网络营销博客 2021-05-28 09:32
悬赏:16
相关标签:
1条回答
  • 2021-05-28 09:42
    @Test
    public void testAnnoConfiguration() throws Exception {
    ApplicationContext applicationContext = new
              AnnotationConfigApplicationContext(SpringConfiguration.class);    UserService userService = (UserService)   
        applicationContext.getBean("userService");
        userService.save();
        DataSource dataSource = (DataSource)
        applicationContext.getBean("dataSource");
        Connection connection = dataSource.getConnection();
        System.out.println(connection);
        }
    20 讨论(0)
提交回复