Spring annotation collection

@Scope ( "the prototype")
Spring default scope is singleton
scope = "prototype" ensures that when there is a request when an Action object is created.

example:

@Scope("prototype")
@Controller
@RequestMapping("/web/login")
public class LoginWebController {
    //private static final Logger logger = Logger.getLogger(LoginWebController.class);
    @Resource(name = "loginService")
    private LoginService loginServiceImpl;
        ..

 

 @Resource

For fitting bean, bean acquired, like the component instance Android Butterknife acquired page.

example

    @Resource(name = "loginService")
    private LoginService loginServiceImpl;

 

Guess you like

Origin www.cnblogs.com/YangBinChina/p/11220128.html