|
@@ -8,9 +8,7 @@ import com.service.impl.MqServiceImpl;
|
8
|
8
|
import com.service.impl.UserServiceImpl;
|
9
|
9
|
import org.springframework.beans.factory.BeanFactory;
|
10
|
10
|
import org.springframework.context.ApplicationContext;
|
11
|
|
-import org.springframework.context.annotation.ComponentScan;
|
12
|
11
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
13
|
|
-import org.springframework.context.support.FileSystemXmlApplicationContext;
|
14
|
12
|
|
15
|
13
|
public class Main {
|
16
|
14
|
public static void main(String[] args) throws Exception {
|
|
@@ -21,14 +19,13 @@ public class Main {
|
21
|
19
|
UserService bean = applicationContext.getBean(UserServiceImpl.class);
|
22
|
20
|
// DruidDataSource dataSource = (DruidDataSource) beanFactory.getBean("dataSource");
|
23
|
21
|
DruidDataSource dataSource = beanFactory.getBean(DruidDataSource.class);
|
24
|
|
- // JdbcData bean1 = beanFactory.getBean(JdbcData.class);
|
|
22
|
+ // JdbcData bean1 = beanFactory.getBean(JdbcData.class);
|
25
|
23
|
DruidPooledConnection connection = dataSource.getConnection();
|
26
|
24
|
connection.close();
|
27
|
25
|
// userService1 在 xml文件中定义
|
28
|
|
- // MqService mqService =(MqService) applicationContext.getBean(MqServiceImpl.class);
|
29
|
|
-// mqService.pushRabbitMessage();
|
30
|
|
-// Thread.sleep(2000);
|
31
|
|
-// mqService.listenRabbitQueue();
|
|
26
|
+ MqService mqService = applicationContext.getBean(MqServiceImpl.class);
|
|
27
|
+ mqService.pushRabbitMessage();
|
|
28
|
+// mqService.listenRabbitQueue();
|
32
|
29
|
}
|
33
|
30
|
|
34
|
31
|
}
|