I don't understand spring dependency injection very well.

if you write your own class, you can understand how to inject it, but how to inject a class that comes with java, such as File
File file = new File (filePath)
like this?
and what if the filePath is calculated while the program is running?

this is just a layer
if it"s something like new OutputStreamWriter (new FileOutputStream (new File (filePath), how do you inject it?

Mar.10,2021

I don't know if I understand your problem. If File, doesn't need to be injected, just use it. If you have to inject, it usually encapsulates a business-level object that contains some of the File, you want to operate on, and then inject the business object into it. In a nutshell, what you usually inject is something like singleton, while for objects that are dynamically created and destroyed, injection is meaningless.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5d191-456f3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5d191-456f3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?