关闭WIN10资讯功能 如何关闭WIN10资讯功能 |
您所在的位置:网站首页 › window10怎么关闭热门资讯 › 关闭WIN10资讯功能 如何关闭WIN10资讯功能 |
java定时器任务中获取request对象 @Scheduled 获取request 对象 quartz中获取request对象
HaHa_Sir:
weixin_42071470:
可以了 谢谢
weixin_42071470:
public class autoTask {
@Autowired
private ServletContext servletContext2;
@Autowired
private HttpServletRequest request;
/*秒 分 时 日 月 周 年*/
@SneakyThrows
@Scheduled(cron = "* * * * * * ")
public String autoTaskXiuXi() {
WebApplicationContext webApplicationContext = ContextLoader.getCurrentWebApplicationContext();
servletContext2 = webApplicationContext.getServletContext();
String realPath = servletContext2.getRealPath(File.separator);
Thread th = Thread.currentThread();
servletContext2 = request.getSession().getServletContext();
Object username = servletContext2.getAttribute("username");
log.warn("start==={}",th.getName());
log.warn("end === realPath {}",realPath);
System.out.println(username);
还是不行 HaHa_Sir: 不确定哦,现在没使用了 解决PDF添加水印报错iText: Font 'STSong-Light' with 'UniGB-UCS2-H' is not recognized裴大有: 博主,itext-2.1.7之后的版本需要付费吗 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |