51,411
社区成员
发帖
与我相关
我的任务
分享
@SpringBootApplication
public class PlatformWebApplication {
public static void main(String[] args) {
SpringApplication.run(PlatformWebApplication.class, args);
}
@Bean
public ServletRegistrationBean getServletRegistrationBean() {
ServletRegistrationBean bean = new ServletRegistrationBean(new Web_Service());
bean.addUrlMappings("/*"); //The same as web servlet annotation
return bean;
}
}
这个是用Spring启动Web_Service类,跟在Web_Service类用用WebsServlet注解一样吗
我希望是每个请求里的数据是互相独立的,跟其他请求无关的
1.都是servlet,当然一样,只是api有一些不同
2.每个请求都是独立的,准确的说是在方法内独立,因为servlet是单例的,所以不同请求间成员变量会共享