MongoDB实现REST

导入依赖

application.properties

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
public class Book {
    private Integer id;
    private String name;
    private String author;
		//get set tostring
}
public interface BookDao extends MongoRepository<Book,Integer> {
    List<Book> findBookByNameContaining(String name);
}

posted @ 2020-08-05 21:38  柒丶月  阅读(251)  评论(0编辑  收藏  举报