共有4种方式: 1、singleton(默认,单例模式) 2、prototype(需要时创建,没有单例工厂的支持) 3、request(spring web支持时可以用) 4、session(spring web支持时可以用)