@Scope(“ prototype”)bean范围未创建新bean
我想在控制器中使用带注释的原型bean。但是春天正在创建一个单例豆。这是该代码: @Component @Scope("prototype") public class LoginAction { private int counter; public LoginAction(){ System.out.println(" counter is:" + counter); } public String getStr() { return " counter is:"+(++counter); } } 控制器代码: @Controller public class HomeController { @Autowired private LoginAction loginAction; @RequestMapping(value="/view", method=RequestMethod.GET) public ModelAndView display(HttpServletRequest req){ ModelAndView mav = new ModelAndView("home"); mav.addObject("loginAction", …