Skip to content

Commit

Permalink
Merge pull request #1371 from zyro23/grails-data-mapping-1368
Browse files Browse the repository at this point in the history
#1368 - respect FactoryBean.getObjectType contract, use context…
  • Loading branch information
puneetbehl committed Aug 18, 2020
2 parents 752d153 + 37bc862 commit 540915f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ class DatastoreServiceMethodInvokingFactoryBean extends MethodInvokingFactoryBea

@Override
Class<?> getObjectType() {
arguments[0] as Class<?>
if (arguments != null && arguments.size() == 1) {
return arguments[0] as Class<?>
}
return super.getObjectType()
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static Logger getLogger(Class type) {
* @return A new service loader
*/
public static <S> SoftServiceLoader<S> load(Class<S> service) {
return SoftServiceLoader.load(service, SoftServiceLoader.class.getClassLoader());
return SoftServiceLoader.load(service, Thread.currentThread().getContextClassLoader());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,7 @@ abstract class AbstractDatastoreInitializer implements ResourceLoaderAware{

private Class<?> loadServiceClass(Class<Service> clazz) {
final String serviceClassName = clazz.package.getName() + '.' + clazz.simpleName[1..-15]
final ClassLoader cl = org.grails.datastore.mapping.reflect.ClassUtils.classLoader
final Class<?> serviceClass = cl.loadClass(serviceClassName)
final Class<?> serviceClass = classLoader.loadClass(serviceClassName)
serviceClass
}

Expand Down

0 comments on commit 540915f

Please sign in to comment.