A Field Annotated with @Id (ORG.SPRINGFRAMEWORK.DATA.ANNOTATION.ID) is mapped to the ' _id ' field.
A field without an annotation but named ' id ' would be mapped to the ' _id ' field.
Need to include Maven dependencies
<Dependency> <groupId>Org.springframework.data</groupId> <Artifactid>Spring-data-commons</Artifactid> <version>1.11.1.RELEASE</version></Dependency>
Spring Configuration
<id= "MONGO" class= " Org.springframework.data.mongodb.core.MongoFactoryBean "> <Name = "Host" value= "localhost"/></Bean >
Specify host.
Reference
Http://docs.spring.io/spring-data/data-mongo/docs/1.4.2.RELEASE/reference/html/mongo.repositories.html
http://docs.spring.io/spring-data/data-mongo/docs/1.8.1.RELEASE/reference/html/#mongo. Repositories
http://docs.spring.io/spring-data/data-mongo/docs/1.8.1.RELEASE/reference/html/#mapping-conventions
Http://docs.spring.io/spring-data/data-mongo/docs/1.4.2.RELEASE/reference/html/mongo.repositories.html
Spring MongoDB Usage