@ -45,6 +45,8 @@ import com.mongodb.ReadPreference;
* information or query hints on them .
* information or query hints on them .
*
*
* @author Mark Paluch
* @author Mark Paluch
* @author Christoph Strobl
* @since 4 . 2
* /
* /
class CrudMethodMetadataPostProcessor implements RepositoryProxyPostProcessor , BeanClassLoaderAware {
class CrudMethodMetadataPostProcessor implements RepositoryProxyPostProcessor , BeanClassLoaderAware {
@ -103,13 +105,15 @@ class CrudMethodMetadataPostProcessor implements RepositoryProxyPostProcessor, B
* /
* /
static MethodInvocation currentInvocation ( ) throws IllegalStateException {
static MethodInvocation currentInvocation ( ) throws IllegalStateException {
MethodInvocation m i = currentInvocation . get ( ) ;
MethodInvocation invocation = currentInvocation . get ( ) ;
if ( mi = = null )
if ( invocation ! = null ) {
throw new IllegalStateException (
return invocation ;
"No MethodInvocation found: Check that an AOP invocation is in progress, and that the "
}
+ "CrudMethodMetadataPopulatingMethodInterceptor is upfront in the interceptor chain." ) ;
return mi ;
throw new IllegalStateException (
"No MethodInvocation found: Check that an AOP invocation is in progress, and that the "
+ "CrudMethodMetadataPopulatingMethodInterceptor is upfront in the interceptor chain." ) ;
}
}
@Override
@Override
@ -163,7 +167,6 @@ class CrudMethodMetadataPostProcessor implements RepositoryProxyPostProcessor, B
static class DefaultCrudMethodMetadata implements CrudMethodMetadata {
static class DefaultCrudMethodMetadata implements CrudMethodMetadata {
private final Optional < ReadPreference > readPreference ;
private final Optional < ReadPreference > readPreference ;
private final Method method ;
/ * *
/ * *
* Creates a new { @link DefaultCrudMethodMetadata } for the given { @link Method } .
* Creates a new { @link DefaultCrudMethodMetadata } for the given { @link Method } .
@ -175,7 +178,6 @@ class CrudMethodMetadataPostProcessor implements RepositoryProxyPostProcessor, B
Assert . notNull ( method , "Method must not be null" ) ;
Assert . notNull ( method , "Method must not be null" ) ;
this . readPreference = findReadPreference ( method ) ;
this . readPreference = findReadPreference ( method ) ;
this . method = method ;
}
}
private Optional < ReadPreference > findReadPreference ( Method method ) {
private Optional < ReadPreference > findReadPreference ( Method method ) {
@ -201,11 +203,6 @@ class CrudMethodMetadataPostProcessor implements RepositoryProxyPostProcessor, B
public Optional < ReadPreference > getReadPreference ( ) {
public Optional < ReadPreference > getReadPreference ( ) {
return readPreference ;
return readPreference ;
}
}
@Override
public Method getMethod ( ) {
return method ;
}
}
}
private static class ThreadBoundTargetSource implements TargetSource {
private static class ThreadBoundTargetSource implements TargetSource {