??????????
???????????UserFactory
????package com.bjsxt.factory;
????import com.bjsxt.model.User;
????public class UserFactory {
????public User CreatUser () {
????User user=new User();
????user.setUsername("??1");
????user.setPassword("oumyye");
????return user;
????}
????}
???????????UserFactory2
????package com.bjsxt.factory;
????import com.bjsxt.model.User;
????public class UserFactory2 {
????public static User CreatUser () {
????User user=new User();
????user.setUsername("?my?1");
????user.setPassword("oumyye");
????return user;
????}
????}
?????????UserService
package com.bjsxt.service;
import com.bjsxt.dao.UserDAO;
import com.bjsxt.model.User;
public class UserService {
private UserDAO userDAO;
public void init() {
System.out.println("###########init");
}
public void save(User user) {
userDAO.save(user);
}
public UserDAO getUserDAO() {
return userDAO;
}
public void setUserDAO(UserDAO userDAO) {
this.userDAO = userDAO;
}
public UserService(UserDAO userDAO) {
super();
this.userDAO = userDAO;
}
public void destroy() {
System.out.println("destroy");
}
}