Hi Spring data users,
Just started playing around with spring data and mongodb. Following the instructions in the reference doc I created a repository interface like this
package net.flexcellence.redux.server.dao.impl;
import net.flexcellence.redux.server.dto.RedUXAsset;
import org.springframework.data.document.mongodb.reposito ry.MongoRepository;
public interface AssetRepository extends MongoRepository<RedUXAsset, String>{}
in my applicationcontext.xml I imported the mongo namespace and added the following:
<bean id="mongo" class="com.mongodb.Mongo">
<constructor-arg value="${mongodb.host}"/>
<constructor-arg value="${mongodb.port}"/>
</bean>
<bean id="mongoTemplate" class="org.springframework.data.document.mongodb.M ongoTemplate">
<constructor-arg ref="mongo"/>
<constructor-arg name="databaseName" value="${mongodb.dbname}"/>
</bean>
<mongo:repositories base-package="net.net.flexcellence.redux.server.dao.imp l" mongo-template-ref="mongoTemplate" />
If I now write a simple unit test, based upon the repository having an autowired property like
@Autowired
private AssetRepository repository;
The Repository is not created and injected. Is there anything I am missing in my config ? Maybe aspectJ is required ?
There is a section in the reference doc "Example 4.6. Standalone usage of repository factory"
but the actual code to create the repositoy programmatically is ommitted
Any help appreciated.
Regards,
Dirk



Reply With Quote
