做了不少项目,遇到不少hibernate配置,对于hibernate.connection.autocommit值的设置,存在很多争议,一些人认为应该设置为true,一些人认为应该设置为false,而我坚决选择后者,下面就来讲讲我的理由吧
by 刘迎光@萤火虫工作室
OpenBI交流群:495266201
MicroService 微服务交流群:217722918
mail: liuyg#liuyingguang.cn
博主首页(防止爬虫):http://blog.liuyingguang.cn
OpenBI问答社区:http://openbi.liuyingguang.cn/
关键代码:
application.java中
register(MultiPartFeature.class);
前端html中:
<form action="${path}/list/uploadExcel" method="post" enctype="multipart/form-data" accept-charset="utf-8"> <p> <input type="file" name="file" /><br /> </p> <input type="submit" value="上传" /> </form>
服务端(有略微的名称编码问题):
<span> </span>@POST @Path("uploadExcel") @Consumes(MediaType.MULTIPART_FORM_DATA) public String uploadExcel( @FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition disposition) { String imageName = Calendar.getInstance().getTimeInMillis() + disposition.getFileName(); //File file = new File("D:\\" + imageName); return "import data succeed"; }
by 刘迎光@萤火虫工作室
OpenBI交流群:495266201
MicroService 微服务交流群:217722918
mail: liuyg#liuyingguang.cn
博主首页(防止爬虫):http://blog.liuyingguang.cn
OpenBI问答社区:http://openbi.liuyingguang.cn/
<dependency> <groupId>org.mongodb</groupId> <artifactId>mongodb-driver</artifactId> <version>3.2.2</version> </dependency>
MongoClientURI uri = new MongoClientURI("mongodb://192.168.100.140:27017/local",MongoClientOptions.builder().cursorFinalizerEnabled(false));MongoClient client = new MongoClient(uri);MongoDatabase db=client.getDatabase("local");MongoCollection<Document> collection = db.getCollection("system.users");List<Document> foundDocument = collection.find().into(new ArrayList<Document>());System.out.println(foundDocument);
MongoClient client = null;ServerAddress serverAddress = new ServerAddress("192.168.100.140",27017);List<ServerAddress> seeds = new ArrayList<ServerAddress>();seeds.add(serverAddress);MongoCredential credentials = MongoCredential.createScramSha1Credential("admin", "admin", "admin".toChar
<repository> <id>mine</id> <name>public Releases</name> <layout>default</layout> </repository> <repository> <id>mine-meteorite-bi-release</id> <name>publ |