当前位置:网站首页>@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);
边栏推荐
- Wechat nucleic acid detection appointment applet system graduation design (2) applet function
- 饭卡 HDU2546
- Vi/vim delete: one line, one character, word, the first character of each line command
- vi/vim 删除:一行, 一个字符, 单词, 每行第一个字符 命令
- 快速排序基本思路(通俗易懂+例子)「建议收藏」
- [Yugong series] July 2022 go teaching course 001 introduction to go language premise
- Basic idea of quick sorting (easy to understand + examples) "suggestions collection"
- 国金证券是国企吗?在国金证券开户资金安全吗?
- 如何设置VSCode删除整行快捷键?
- 再放宽!这些应届生,可直接落户上海
猜你喜欢
Nm01 function overview and API definition of nm module independent of bus protocol
Leetcode 面试题 16.15. 珠玑妙算
微信核酸检测预约小程序系统毕业设计毕设(4)开题报告
巴比特 | 元宇宙每日必读:一千块就能买一个虚拟主播?这是小企业的直播福音还是在“割韭菜”?...
Esp32-c3 introductory tutorial question ⑩ - error: implicit declaration of function 'ESP_ blufi_ close‘;
Please, stop painting star! This has nothing to do with patriotism!
Redis(7)----数据库与过期键
Wechat nucleic acid detection and appointment applet system graduation design (3) background function
300+ documents! This article explains the latest progress of multimodal learning based on transformer
初夏,开源魔改一个带击杀音效的电蚊拍!
随机推荐
Leetcode 面试题 16.15. 珠玑妙算
Babbitt | metauniverse daily must read: can you buy a virtual anchor for 1000 yuan? Is this the live gospel of small businesses or "cutting leeks"
Qt官方示例:Qt Quick Controls - Gallery
微信小程序视频分享平台系统毕业设计毕设(2)小程序功能
Wechat applet video sharing platform system graduation design completion (4) opening report
Win10 uninstall CUDA
夜神模拟器+Fiddler抓包测试App
Basic idea of quick sorting (easy to understand + examples) "suggestions collection"
哪个券商公司网上开户佣金低又安全又可靠
微信核酸检测预约小程序系统毕业设计毕设(3)后台功能
iframe嵌套详解
Web聊天工具
微信小程序视频分享平台系统毕业设计毕设(1)开发概要
如何设置VSCode删除整行快捷键?
Installation tutorial and simple call of Matplotlib
C# 检测图片是否被旋转并修改到正真的旋转
Qt官方示例:Qt Quick Controls - Gallery
Typescript
Wechat applet video sharing platform system graduation design completion (8) graduation design thesis template
深度神经网络总结