1 package demoinfo.spring.ioc;
2
3 /**
4 * 磁盘业务的业务JavaBean类
5 */
6 public class BusinessBean {
7 private IDeviceWriter writer;
8
9 public void setDeviceWriter(IDeviceWriter writer) {
10 this.writer = writer;
11 }
12
13 public IDeviceWriter getDeviceWriter() {
14 return writer;
15 }
16
17 public void save() {
18 if (writer == null) {
19 throw new RuntimeException("DeviceWriter needed...");
20 }
21 writer.saveToDevice();
22 }
23 }