Spring6.0官方文档示例:(25)@RequestScope注解

package cn.edu.tju.controller.listener;

import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.RequestScope;

import java.util.Date;

@Component
@RequestScope
//@Scope(value = "request",proxyMode= ScopedProxyMode.TARGET_CLASS)
public class StudentService {
    public StudentService(){
        System.out.println("create a student service @ " + new Date());
    }
    public String getInfo(){
        //System.out.println(this);
        return "get info ";
    }
}

你可能感兴趣的:(Spring,java,开发语言)