src/main/java/com/luoyunfan/util/TestSpring.java

(完整代码) 1KB

package com.luoyunfan.util;

 
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.luoyunfan.service.impl.StudentService;
 

public class TestSpring {
	public static void main(String[] args) {
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
				new String[] {"com/luoyunfan/conf/applicationContextaop.xml"});
//		
//		bean构造
//		StudentService studentService = (StudentService) applicationContext.getBean("studentService1");
//		
//		StudentService studentService2 = (StudentService) applicationContext.getBean("studentService2");
//		
//		StudentService studentService3 = (StudentService) applicationContext.getBean("studentService3");
//		
//		StudentService studentService4 = (StudentService) applicationContext.getBean("studentService4");
////-------------------------------------------------------------------------------------------------------		
//		IStudentService studentService = (StudentService) applicationContext.getBean("studentService");
//		studentService.create(0);
		//基于注解的配置
//		IStudentService studentService = (StudentService) applicationContext.getBean("StudentService");
//		studentService.create();
		//代理
//		IStudentService studentService = (IStudentService) applicationContext.getBean("StudentServiceProxy");
//		studentService.create();
		//aop
//		IStudentService studentService = (IStudentService) applicationContext.getBean("studentService");
//		studentService.create();
	}
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。