use of org.springframework.data.projection.SpelAwareProxyProjectionFactory in project spring-data-mongodb by spring-projects.
the class ReactiveStringBasedMongoQueryUnitTests method createQueryForMethod.
private ReactiveStringBasedMongoQuery createQueryForMethod(ReactiveQueryMethodEvaluationContextProvider contextProvider, String name, Class<?>... parameters) throws Exception {
Method method = SampleRepository.class.getMethod(name, parameters);
ProjectionFactory factory = new SpelAwareProxyProjectionFactory();
ReactiveMongoQueryMethod queryMethod = new ReactiveMongoQueryMethod(method, new DefaultRepositoryMetadata(SampleRepository.class), factory, converter.getMappingContext());
return new ReactiveStringBasedMongoQuery(queryMethod, operations, PARSER, contextProvider);
}
use of org.springframework.data.projection.SpelAwareProxyProjectionFactory in project spring-data-mongodb by spring-projects.
the class StringBasedMongoQueryUnitTests method createQueryForMethod.
private StringBasedMongoQuery createQueryForMethod(String name, Class<?>... parameters) {
try {
Method method = SampleRepository.class.getMethod(name, parameters);
ProjectionFactory factory = new SpelAwareProxyProjectionFactory();
MongoQueryMethod queryMethod = new MongoQueryMethod(method, new DefaultRepositoryMetadata(SampleRepository.class), factory, converter.getMappingContext());
return new StringBasedMongoQuery(queryMethod, operations, PARSER, QueryMethodEvaluationContextProvider.DEFAULT);
} catch (Exception e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
use of org.springframework.data.projection.SpelAwareProxyProjectionFactory in project spring-data-mongodb by spring-projects.
the class MongoRepositoryFactoryUnitTests method setUp.
@BeforeEach
@SuppressWarnings("unchecked")
public void setUp() {
when(template.getConverter()).thenReturn(converter);
when(converter.getMappingContext()).thenReturn(mappingContext);
when(converter.getProjectionFactory()).thenReturn(new SpelAwareProxyProjectionFactory());
}
Aggregations