package com.cgs.edu.firstPro;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;
import org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper;
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import com.mongodb.Mongo;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
@Configuration
@PropertySource("classpath:/application.properties")
public class MongoConfig {
@Autowired
Environment env;
@Bean
public Mongo mongo() throws Exception {
return new MongoClient(new MongoClientURI(env.getProperty("mongodb.uri", "mongodb://localhost")));
}
@Bean
public MongoTemplate mongoTemplate() throws Exception {
MongoDbFactory mongoFactory = new SimpleMongoDbFactory(mongo(), env.getProperty("mongodb.db", "admin"));
//remove _class in the created documents
MappingMongoConverter converter = new MappingMongoConverter(new DefaultDbRefResolver(mongoFactory), new MongoMappingContext());
converter.setTypeMapper(new DefaultMongoTypeMapper(null));
return new MongoTemplate(mongoFactory, converter);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
springboot+angularjs+mongodb实现表单内容显示
共38个文件
html:8个
js:6个
class:6个
4星 · 超过85%的资源 需积分: 50 81 下载量 67 浏览量
2016-05-23
17:14:09
上传
评论
收藏 645KB ZIP 举报
温馨提示
基于当前流行框架SpringBoot框架实现与mongodb数据库的连接,并把查询结果返回到页面表单中。该项目很适合刚接触springboot的开发者学习,有助于对各个基本注解的了解,从而更好地从事web开发。
资源推荐
资源详情
资源评论
收起资源包目录
firstPro.zip (38个子文件)
firstPro
pom.xml 2KB
target
test-classes
com
cgs
edu
firstPro
AppTest.class 627B
classes
META-INF
maven
com.cgs.edu
firstPro
pom.xml 2KB
pom.properties 242B
MANIFEST.MF 264B
application.properties 227B
templates
user_detail.html 573B
userdetail.html 646B
com
cgs
edu
firstPro
User.class 1KB
UserService.class 963B
App.class 2KB
MongoConfig.class 2KB
UserController.class 1KB
static
user_detail.html 573B
js
angular.min.js 142KB
angular-route.js 33KB
angular.js 1.02MB
userdetail.html 639B
.settings
org.eclipse.m2e.core.prefs 90B
org.eclipse.core.resources.prefs 155B
org.eclipse.jdt.core.prefs 243B
src
test
java
com
cgs
edu
firstPro
AppTest.java 686B
main
resources
templates
user_detail.html 573B
userdetail.html 646B
static
user_detail.html 573B
js
angular.min.js 142KB
angular-route.js 33KB
angular.js 1.02MB
userdetail.html 639B
java
application.properties 227B
com
cgs
edu
firstPro
User.java 564B
MongoConfig.java 2KB
UserController.java 1KB
UserService.java 419B
App.java 1KB
.project 560B
.classpath 1KB
Readme 192B
共 38 条
- 1
资源评论
- ytfxcy2020-01-02下载了,多谢分享
- 叶梦星辰2016-10-26谢谢分享。
- miles_wei2016-11-30非常感谢,很有用
hancy1993
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功