In earlier versions of Sling Models the use of the annotation @inject was suggested and documented; but over time it turned out that it had some major issues
Please read the post on below URL
https://aemhelper.blogspot.com/2023/08/inject-discouraged-sling-model.html
Happy Reading...!