2016-05-09 88 views
-2

我正在使用弹簧数据来存储和从数据库中提取记录。最初数据库是MySQL,但现在我想为mongodb配置相同的应用程序。请为MysQL申请资源属性。mongodb的弹簧数据配置

# =============================== 
# = DATA SOURCE 
# =============================== 
# Connection url for the database connection 
spring.datasource.url = jdbc:mysql://localhost:27017/purchase_books 

# Username and password 
spring.datasource.username = root 
spring.datasource.password = root 

# Keep the connection alive if idle for a long time (needed in production) 
spring.datasource.testWhileIdle = true 
spring.datasource.validationQuery = SELECT 1 

# =============================== 
# = JPA/HIBERNATE 
# =============================== 
# Show or not log for each sql query 
spring.jpa.show-sql = true 

# Hibernate ddl auto (create, create-drop, update): with "update" the database 
# schema will be automatically updated accordingly to java entities found in the project 
spring.jpa.hibernate.ddl-auto = update 

# Naming strategy 
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy 

# Allows Hibernate to generate SQL optimized for a particular DBMS 
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect 

任何人都可以告诉配置变化的情况下,mongodb?

+0

有一个很好的关于MongoDb的Spring Data的文档在他们的s伊特。 –

回答