导入依赖
application.properties
1
2
3
4
5
6
|
spring.data.mongodb.host=127.0.0.1 spring.data.mongodb.authentication-database=admin spring.data.mongodb.username=root spring.data.mongodb.password=root spring.data.mongodb.port=27017 spring.data.mongodb.database= test |
1
2
3
4
5
6
|
public class Book { private Integer id; private String name; private String author; //get set tostring } |
1
2
3
|
public interface BookDao extends MongoRepository<Book,Integer> { List<Book> findBookByNameContaining(String name); } |
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。
原文链接:https://www.cnblogs.com/qiuwenli/p/13442933.html