当前位置:网站首页>@Component 拿不到dao层
@Component 拿不到dao层
2022-07-02 17:04:00 【呜呜艾伦】
@Slf4j
@ServerEndpoint("/webSocket/addOrder/{userId}")
@Component
public class AddOrderSocket {
@Resource
ScreenshotLogRepository screenshotLogRepository;
拿不到dao层
这样拿
package com.gm.wj.service;
import com.gm.wj.entity.ScreenshotLog;
import com.gm.wj.repository.ScreenshotLogRepository;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
@Component
public class WebSocketDbService {
// public static MqttEquipRedService mqttRideService;
public static WebSocketDbService webSocketDbService;
@Resource
public ScreenshotLogRepository screenshotLogRepository;
@PostConstruct
public void init() {
webSocketDbService = this;
}
}
ScreenshotLogRepository screenshotLogRepository=
WebSocketDbService.webSocketDbService.screenshotLogRepository;
log.info("screenshotLogRepository {}",screenshotLogRepository);
if(screenshotLogRepository==null){
log.info("screenshotLogRepository 是null ");
return;
}
log.info("screenshotLog {}",screenshotLog);
screenshotLog.setCreateTime(new Date());
// ScreenshotLog screenshotLog = jsonObject.toJavaObject(ScreenshotLog.class);
ScreenshotLog save = screenshotLogRepository.save(screenshotLog);
log.info("save {}",save);
边栏推荐
- Détends - toi encore! Ces nouveaux étudiants peuvent s'installer directement à Shanghai
- Steamos 3.3 beta release, steam deck Chinese keyboard finally came
- Uncover the whole link communication process of dewu customer service im
- 夜神模拟器+Fiddler抓包测试App
- 微信小程序视频分享平台系统毕业设计毕设(2)小程序功能
- 夜神模擬器+Fiddler抓包測試App
- Leetcode 面试题 17.04. 消失的数字
- 1.5.1版本官方docker镜像运行容器,能设置使用 mysql 8驱动吗?
- RDK仿真实验
- 再放宽!这些应届生,可直接落户上海
猜你喜欢
![[Yugong series] July 2022 go teaching course 001 introduction to go language premise](/img/f2/3b95f53d67cd1d1979163910dbeeb8.png)
[Yugong series] July 2022 go teaching course 001 introduction to go language premise

27:第三章:开发通行证服务:10:【注册/登录】接口:注册/登录OK后,把用户会话信息(uid,utoken)保存到redis和cookie中;(一个主要的点:设置cookie)

微信小程序视频分享平台系统毕业设计毕设(6)开题答辩PPT

又一所双非改考408,会爆冷么?南昌航空大学软件学院

Wechat nucleic acid detection appointment applet system graduation design completion (4) opening report

Wechat nucleic acid detection appointment applet system graduation design (2) applet function

Wechat applet video sharing platform system graduation design (2) applet function

Wechat applet video sharing platform system graduation design completion (4) opening report

RDK仿真实验

实施阴影介绍
随机推荐
Rte11 interrupt decoupling function
Redis(7)----数据库与过期键
Paddlepaddle 28 build an automatic coder based on convolution
消除IBM P750小机上的黄色报警灯[通俗易懂]
Wechat nucleic acid detection appointment applet system graduation design (2) applet function
阿里三面被面试官狂问Redis,简历上再也不敢写'精通'了
Wechat applet video sharing platform system graduation design (3) background function
Qt官方示例:Qt Quick Controls - Gallery
微信小程序视频分享平台系统毕业设计毕设(7)中期检查报告
Iframe nesting details
RDK仿真实验
深度神经网络总结
哪个券商公司网上开户佣金低又安全又可靠
如何优雅的写 Controller 层代码?
Mysql 备份的三种方式
巴比特 | 元宇宙每日必读:一千块就能买一个虚拟主播?这是小企业的直播福音还是在“割韭菜”?...
A4988 and 42 stepper motors
Leetcode 面试题 17.04. 消失的数字
RTE11- 中断解耦功能
微信小程序视频分享平台系统毕业设计毕设(5)任务书