whorvath2 opened a new issue, #16177:
URL: https://github.com/apache/grails-core/issues/16177

   ### Expected Behavior
   
   Service beans that depend on other service beans shouldn't have to add 
`@Autowired` to their fields to have them injected (unless that's intended 
behavior; I checked the upgrade guidance this time but couldn't find anything.)
   
   ### Actual Behaviour
   
   I have a collection of service beans, some of which have other service beans 
as fields. The field beans were auto-injected into their enclosing services in 
M3, but aren't doing so in M5 (i.e., the field values are `null`), resulting in 
`InvocationTargetException`s when those field's methods are called. However, I 
found that adding `@Autowired` to the fields forces the injections. For 
example, here's a before:
   ```
   @Service
   class LicenseService {
   
       InvoiceService invoiceService
       ProjectUserService projectUserService
       ProjectService projectService
   ```
   And here's what it looks like now, which allows the `licenseService` to work 
when (e.g.) it uses its `invoiceService` instance:
   ```
   @Service
   class LicenseService {
   
       @Autowired
       InvoiceService invoiceService
       @Autowired
       ProjectUserService projectUserService
       @Autowired
       ProjectService projectService
   ```
   
   ### Steps To Reproduce
   
   _No response_
   
   ### Environment Information
   
   
[build.gradle](https://github.com/user-attachments/files/31242426/build.gradle.txt)
   
   ------------------------------------------------------------
   Gradle 9.5.1
   ------------------------------------------------------------
   
   Build time:    2026-05-12 13:19:42 UTC
   Revision:      fd78213f09782e62ca4957f9cfd3d90c6c3f1767
   
   Kotlin:        2.3.20
   Groovy:        4.0.29
   Ant:           Apache Ant(TM) version 1.10.15 compiled on August 25 2024
   Launcher JVM:  25.0.3 (Amazon.com Inc. 25.0.3+9-LTS)
   Daemon JVM:    /Users/bhorvath/.sdkman/candidates/java/25.0.3-amzn (no 
Daemon JVM specified, using current Java home)
   OS:            Mac OS X 26.6.2 aarch64
   
   | Grails Version: 8.0.0-M5
   | JVM Version: 25.0.3
   
   
   ### Example Application
   
   _No response_
   
   ### Version
   
   8.0.0-M5


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to