1. 程式人生 > >idea警告:Field injection is not recommended

idea警告:Field injection is not recommended

1. 使用@Autowire注入時警告:Field injection is not recommended

2. 被警告程式碼:

    @Autowired
    private EduWorkInfoMapper eduWorkInfoMapper;

    @Autowired
    private IEduExportUserInfoService eduExportUserInfoService;

3. 警告顯示:


4. 原因:不建議使用屬性注入,其實當你滑鼠滑動到@Autowired上面,同時按下alt+enter鍵時,就會看到下面這樣的提示


這說明編輯器建議你使用構造注入的方式進行bean的注入。

5. 說明:

參考地址

6. 解決方法:

    private IWorkLoadService workLoadService;
    private IEduExportUserInfoService eduExportUserInfoService;
    private IWorkLoadJobsService workLoadJobsService;

    @Autowired
    public WorkLoadController( IWorkLoadService workLoadService
            ,IEduExportUserInfoService eduExportUserInfoService
            ,IWorkLoadJobsService workLoadJobsService ){
        this.workLoadService = workLoadService;
        this.eduExportUserInfoService = eduExportUserInfoService;
        this.workLoadJobsService = workLoadJobsService;
    }



相關推薦

idea警告Field injection is not recommended

1. 使用@Autowire注入時警告:Field injection is not recommended 2. 被警告程式碼: @Autowired private EduWorkInfoMapper eduWorkInfoMapper;

【Spring】@Autowired註解Field injection is not recommended

參考文章:http://vojtechruzicka.com/field-dependency-injection-considered-harmful/     首先對於還不熟悉@Autowired的同學當然也包括我先去看看它到底有什麼作用。—

Field injection is not recommended 依賴注入方式

    首先對於還不熟悉@Autowired的同學當然也包括我先去看看它到底有什麼作用。—自動裝配     大體意思就是就是說用了它就可以省去類裡面的set/get方法,也不用在xml檔案中要注入的類中設定屬性,它會根據@Autowired註釋自動

IDEA警告SQL dialect is not configured

Idea能自動給我們檢查拼接的sql語句的語法正確性,當然需要進行一定的配置。 在報警告的地方,單擊過後,按下快捷鍵Alt+Enter進入設定, 然後點選Generic,設定其dialect。 例如,

解決編譯時出現的警告format string is not a string literal (potentially insecure)┊

在Xcode 4.2(iOS 5)之前,我猜大家都和我一樣很喜歡下面的除錯輸出寫法: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 NSStrin

pycharmanaconda installation is not found interpreter field is empty

出現這個問題,首先確保已經安裝了Anaconda如果安裝後,還是出現這個提示,可以嘗試下以下步驟,開啟cmd輸入以下命令:mklink /D %HOMEPATH%\anaconda C:\ProgramData\Anaconda3注意後面的目錄腰圍你的Anaconda安裝目錄

IntelliJ IDEA 或Android Studio中提示Project SDK is not defined

之前用Android Studio去開啟一個專案後,結果遇到提示: Project SDK is not defined 如圖: 【解決過程】 1.試著去點選Setup SDK,出現設定對話方塊: 然後就卡死了好一會。 然後就好了,就沒了這個提示了。 【總結】 好像是

zabbix web 登錄成功後提示(紅色提示)zabbix server is not running:the information displayed may not be current

aid blog sed 地址 成功 current use schema clas 原因是我配了外網地址因應是內網的: # cat /etc/zabbix/web/zabbix.conf.php <?php // Zabbix GUI configuration

運行用例時,報錯Unknow ErrorElement xxx is not clickable……的解決方法

cut 處理 ebe 將他 最好 executor tro path img 通常這種情況是由於在點擊該元素時,js更換了元素屬性造成的。 所以可以采用js的方式進行處理 方法如下: WebDriver driver = new FirefoxDriver(); Web

Mysql連接報錯1130-host ... is not allowed to connect to this MySql server如何處理

nmp mage htm 庫服務器 strong 所在 conn bsp -1   這個問題是因為在數據庫服務器中的mysql數據庫中的user的表中沒有權限(也可以說沒有用戶),下面將記錄我遇到問題的過程及解決的方法。   在搭建完LNMP環境後用Navicate連接出錯

跨域問題,Request header field XXXXX is not allowed by Access-Control-Allow-Headers 的問題

允許 span 一個 cti requested action soa ted tom <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Ori

WARN: Establishing SSL connection without server's identity verification is not recommended

.com left strong ren time req jdbc連接 using new 0.要想用Java連接mysql數據庫,首先裝好JDK,配置好環境變量,將jdk*.*.*\lib放入classpath,將jdk*.*.*\bin放入path中(*.*.*表示版

zabbix安裝後提示Zabbix server is not running

zabbix安裝zabbix後,配置相關選項,報警提示以下結果:server is not running:the information displayed may not be current查看zabbix的相關配置後發現都沒有錯誤,仔細想想看防火墻,SELinux和時間的問題。1.檢查防火墻[root

header field token is not allowed by Access-Control-Allow-Headers in preflight response問題解決

-c 後臺服務 ons flight response 我只 expr 分享圖片 bubuko 今天下午,本來打算使用aioxs在header裏傳一個token給後臺服務器,如下圖所示: 結果,控制臺報了如下的錯: 然後,我不停地百度,不停的改後臺express的he

eclispe集成Scalas環境後,導入外部Spark包報錯object apache is not a member of package org

lisp ava ips package ack 網上 scala環境 sca ember 在Eclipse中集成scala環境後,發現導入的Spark包報錯,提示是:object apache is not a member of package org,網上說了一大推,

Establishing SSL connection without server's identity verification is not recommended

database ide lis ring LISHI ati void name -a SpringBoot 連接 MySQL 數據庫,但是卻獲得以下錯誤信息提示:Warning: Wed Dec 09 22:46:52 CET

解決Hive的Establishing SSL connection without server's identity verification is not recommended問題

問題描述: hive> Sat Oct 13 15:36:32 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According

MySQL WARN: Establishing SSL connection ...... is not recommended.

在後臺開發過程中有時會使用到MySQL,那麼在瀏覽器或者Postman等工具上面進行對資料庫資料進行操作的時候有時候會看到IDE中彈出如下警告: 報錯:Tue Oct 30 16:44:38 CST 2018 WARN: Establishing SSL connection without serv

Linux篇tar: Error is not recoverable: exiting now

[[email protected] local]# tar -zxvf MySQL-5.5.48-1.linux2.6.x86_64.rpm-bundle.tar gzip: stdin: not in gzip format tar: Child returned status 1

爬蟲報錯‘NoneType’ object is not iterable

根據《python網路爬蟲從入門到實踐》學習安居客租房資料爬取時,執行程式碼: tags = [i.text for i in tag_list] 出現以下報錯: ‘NoneType’ object is not iterable 列印tag_list發現,其中有多個元素為None,