Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2012 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.data.mongodb.repository.cdi;
import  org.springframework.util.Assert;

CdiRepositoryBean to create Mongo repository instances.

Author(s):
Oliver Gierke
public class MongoRepositoryBean<T> extends CdiRepositoryBean<T> {
	private final Bean<MongoOperationsoperations;

Creates a new MongoRepositoryBean.

Parameters:
operations must not be null.
qualifiers must not be null.
repositoryType must not be null.
beanManager must not be null.
	public MongoRepositoryBean(Bean<MongoOperationsoperationsSet<AnnotationqualifiersClass<T> repositoryType,
			BeanManager beanManager) {
		super(qualifiersrepositoryTypebeanManager);
		Assert.notNull(operations);
		this. = operations;
	}
	/* 
	 * (non-Javadoc)
	 * @see org.springframework.data.repository.cdi.CdiRepositoryBean#create(javax.enterprise.context.spi.CreationalContext, java.lang.Class)
	 */
	protected T create(CreationalContext<T> creationalContextClass<T> repositoryType) {
		MongoRepositoryFactory factory = new MongoRepositoryFactory(mongoOperations);
		return factory.getRepository(repositoryType);
	}
New to GrepCode? Check out our FAQ X