jdaugherty commented on code in PR #15429:
URL: https://github.com/apache/grails-core/pull/15429#discussion_r2836406718


##########
grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/bootstrap/AbstractDatastoreInitializer.groovy:
##########
@@ -330,6 +330,19 @@ abstract class AbstractDatastoreInitializer implements 
ResourceLoaderAware {
                 final Class<Service> clazz = serviceDefinition.getType()
                 final Class<?> serviceClass = loadServiceClass(clazz)
                 final grails.gorm.services.Service ann = 
clazz.getAnnotation(grails.gorm.services.Service)
+
+                // Skip services whose domain class is not mapped in this 
initializer.
+                // When persistentClasses is explicitly set, only register 
services for
+                // domains that are actually configured - prevents classpath 
pollution from
+                // unrelated @Service implementations (e.g., TCK test 
services) causing
+                // startup failures due to missing datasource connections.
+                if (ann != null && !persistentClasses.isEmpty()) {

Review Comment:
   This seems like a risky change to the production code to support tests.  We 
need to discuss this one



-- 
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