package com.example;
import com.example.service.BeanService;
import com.example.service.BookService;
import com.example.service.StudentService;
import com.example.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* Hello world!
*
*/
public class App {
public static void main( String[] args ) {
// ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
// BookService bookService = (BookService) ctx.getBean("bookService");
// bookService.save();
// ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
// UserService userService = (UserService) ctx.getBean("userService");
// userService.save();
// ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
// StudentService studentService = (StudentService) ctx.getBean("studentService");
// studentService.save();
ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
BeanService beanService1 = (BeanService) ctx.getBean("beanService");
System.out.println(beanService1);
BeanService beanService2 = (BeanService) ctx.getBean("beanService");
System.out.println(beanService2);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
期末向Bean的实例化源代码
共17个文件
java:7个
class:7个
xml:3个
需积分: 0 0 下载量 83 浏览量
2023-12-12
14:27:33
上传
评论
收藏 11KB ZIP 举报
温馨提示
期末向Bean的实例化源代码
资源推荐
资源详情
资源评论
收起资源包目录
BeanInstance.zip (17个子文件)
BeanInstance
pom.xml 778B
src
main
resources
spring.xml 1KB
java
com
example
service
UserService.java 255B
BookService.java 267B
StudentService.java 262B
BeanService.java 65B
App.java 1KB
staticfactory
UserServiceFactory.java 330B
instancefactory
StudentServiceFactory.java 311B
target
classes
spring.xml 1KB
com
example
service
BeanService.class 298B
BookService.class 591B
StudentService.class 601B
UserService.class 591B
staticfactory
UserServiceFactory.class 474B
instancefactory
StudentServiceFactory.class 514B
App.class 1017B
generated-sources
annotations
共 17 条
- 1
资源评论
咏婵
- 粉丝: 71
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功