mongoTemplate修改时如何传入一个对象 1C

第一次使用mongoDB来开发java项目,整合了Spring,有一个user类,里面有id,name和password,想在修改的时候直接传入一个user对象,因为之前mysql的时候一直是这么干的。。。但是测试时发现不起作用,因为关于mongoTemplate的文档比较少,也一直没查到,所以有几个问题想请教一下高手,望不吝赐教,谢谢!

service相关代码

    public int updateUser(User user) {
    mongoTemplate.updateFirst(new Query(Criteria.where("id").is(user.getId())),Update.update("user", user), User.class, USER_COLLECTION);
        return 0;
    }


测试类相关代码

    @Test
    public void userAddTest() throws Exception {
        User user = new User();
        user.setName("zhangsan");
        user.setPassword("123abc");
        userService.addUser(user);

        List<User> list = userService.listAll();
        for (User user2 : list) {
            System.out.println(user2.getName());
            System.out.println(user2.getPassword());
        }

        System.out.println("*********************");
        user.setName("lisi");
        userService.updateUser(user);

        list = userService.listAll();
        for (User user2 : list) {
            System.out.println(user2.getName());
            System.out.println(user2.getPassword());
        }
    }

测试结果:

    zhangsan
    123abc
*********************
    zhangsan
    123abc

对了,还有一个问题,就是那个Update类中的update(String key, Object Value)里面的key 和 value是什么?因为在文档里没有查到……所以还烦请一并赐教,谢谢~

3个回答

key是mongodb里面集合里的字段名,value是你要修改的值,要传入对象你可以看看spring data mongodb。用jpa方式操作简单

我在项目中使用的是spring mongotemplate,是修改某个字段,希望下面链接对你有帮助
http://dashen100.com/question/984

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
MongoTemplate查询内嵌子文档如何查询
MongoTemplate查询内嵌子文档如何查询?![](https://gss0.baidu.com/-fo3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/b17eca8065380cd78f44d231a744ad3458828197.jpg)
security中使用mongotemplate.find()方法无法查询并报空指针
user实体类 ``` @Document public class User implements UserDetails{ private static final long serialVersionUID = 2L; String id; String username; String password; List<SimpleGrantedAuthority> grantedAuthorities; public User(String id, String username, String password, List<SimpleGrantedAuthority> grantedAuthorities) { this.id = id; this.username = username; this.password = password; this.grantedAuthorities = grantedAuthorities; } } ``` 其中,list 为继承UserDetails 必须要写的属性,会作为对象传入数据库中,不继承且没有此属性的时候并不会出错 被CustomUserDetailService调用的UserService,用于存取user对象 ``` @Service public class UserService { private static final String USER_COLLECTION = "user"; @Autowired MongoTemplate mongoTemplate; public void saveUser(User user){ mongoTemplate.insert(user); } public User findUserByName(String name){ User user = mongoTemplate.findOne(new Query(Criteria.where("username").is(name)), User.class, USER_COLLECTION); return user; } } ```
mongoTemplate 中的mapreduce 的详细用法
求讲解mongoTemplate 中的mapreduce 的详细用法
为什么mongoTemplate老是null?
为什么mongoTemplate老是null? springmvc mongo intellij idea macos 错误信息为java.lang.NullPointerException 各位大神你们好 我正在用MacOS上面的itellij idea搭建一个APP的后台,现在需要集成mongo,我现在遇到了一个问题。就是每次发请求访问后台接口,mongoTemplate总是null? 有好心人请帮帮我,跪求,我刚刚自己写后台一周,我的QQ1746483621。
mongoTemplate 复杂查询问题?
![图片说明](https://img-ask.csdn.net/upload/201609/08/1473304592_542750.png) 利用mongoTemplate查询‘timeStamp’字段中某一天的所有整点数据,能使用一条语句完成。
mongoTemplate 查询结果,按子文档中的一个字段排序,要怎么实现?
要查询的mongo数据: ``` { "_id" : ***, "_class" : "***", "downloadCount" : { "china" : 20, "google" : 10 } } { "_id" : ***, "_class" : "***", "downloadCount" : { "china" : 10, "google" : 5 } } { "_id" : ***, "_class" : "***", "downloadCount" : { "china" : 15, "google" : 2 } } ``` 查询: ``` Query query = new Query(); query.with(new Sort(Direction.DESC, "downloadCount.china")); mongoTemplate.find(query, this.getEntityClass()); ``` 错误信息: ``` java.lang.IllegalAccessError: org/springframework/beans/PropertyMatches at org.springframework.data.mapping.PropertyReferenceException.detectPotentialMatches(PropertyReferenceException.java:134) at org.springframework.data.mapping.PropertyReferenceException.<init>(PropertyReferenceException.java:59) at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:75) at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327) at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307) at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:291) at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:273) at org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.getPath(QueryMapper.java:837) at org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.<init>(QueryMapper.java:729) ``` 查询子文档也是不可以,报相同的错误!!!! query.addCriteria(Criteria.where("downloadCount.china").is(10)); 只有单层的查询和排序是可以正常的,但是我用mongo语句就是可以正常查询和排序的。 跪求大神帮助!!!
MongoDB用MongoTemplate如何查询
数据格式 { "city":{ "town":{ "people":10000 } } } 想查询Town下的people,求大神解答~十分感谢
MongoTemplate 联合查询
mongo 有没有 类似MySQL的那种多表查询??望指教,万分感谢
MongoTemplate.find()求大神指点
Query query = Query.query(Criteria.where("messageKey").is(messageKey).and("status").is(ApiConstants.STATUS_SUCCESS)); query.with(new Sort(Direction.DESC, "createDate")); List<IntegrationMessage> integrationMessageList = mongoTemplate.find(query, IntegrationMessage.class); 请求大神告诉这段代码是如操作数据库的,哪个参数是数据库的表名
mongoTemplate查询出现问题
错误信息:Due to limitations of the com.mongodb.BasicDocument, you can't add a second 'null' criteria. Query already contains '{ \"$and\" : [{ \"filmNumTime\" : { \"$gte\" : \"2019-05-29 00:00:00\" } }, { \"filmNumTime\" : { \"$lte\" : \"2019-05-30 12:00:00\" } }] }![图片说明](https://img-ask.csdn.net/upload/201905/20/1558342467_895725.png)
java使用MongoTemplate对mongdb执行插入报错code13
我再服务器上最mongodb执行插入时成功了 但是在java中执行插入却报错了 这是服务器上插入成功的图片 ![图片说明](https://img-ask.csdn.net/upload/201906/18/1560823191_65456.jpg) 这是用户的角色权限 ![图片说明](https://img-ask.csdn.net/upload/201906/18/1560823250_572626.jpg) 这是后台代码的报错 com.mongodb.MongoCommandException: Command failed with error 13: 'not authorized on mongoMuckplatform to execute command { insert: "user", ordered: true, documents: [ { _id: "22222", loginName: "mongo", passWord: "123456", userName: "MongoDB", age: 10, sex: 175, _class: "com.dzl.muckcommon.entity.User" } ] }' on server 192.168.8.60:27017. The full response is { "ok" : 0.0, "errmsg" : "not authorized on mongoMuckplatform to execute command { insert: \"user\", ordered: true, documents: [ { _id: \"22222\", loginName: \"mongo\", passWord: \"123456\", userName: \"MongoDB\", age: 10, sex: 175, _class: \"com.dzl.muckcommon.entity.User\" } ] }", "code" : 13 } at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:179) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:293) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:255) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:99) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:444) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.internal.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:72) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:200) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.internal.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:269) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:131) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.operation.MixedBulkWriteOperation.executeCommand(MixedBulkWriteOperation.java:418) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.operation.MixedBulkWriteOperation.executeBulkWriteBatch(MixedBulkWriteOperation.java:256) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.operation.MixedBulkWriteOperation.access$700(MixedBulkWriteOperation.java:67) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:200) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:191) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.operation.OperationHelper.withReleasableConnection(OperationHelper.java:424) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:191) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:67) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:193) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.client.internal.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:960) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.client.internal.MongoCollectionImpl.executeInsertOne(MongoCollectionImpl.java:494) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.client.internal.MongoCollectionImpl.insertOne(MongoCollectionImpl.java:478) ~[mongo-java-driver-3.8.2.jar:na] at com.mongodb.client.internal.MongoCollectionImpl.insertOne(MongoCollectionImpl.java:472) ~[mongo-java-driver-3.8.2.jar:na] at org.springframework.data.mongodb.core.MongoTemplate$6.doInCollection(MongoTemplate.java:1443) ~[spring-data-mongodb-2.1.6.RELEASE.jar:2.1.6.RELEASE] at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:545) ~[spring-data-mongodb-2.1.6.RELEASE.jar:2.1.6.RELEASE] at org.springframework.data.mongodb.core.MongoTemplate.insertDocument(MongoTemplate.java:1436) ~[spring-data-mongodb-2.1.6.RELEASE.jar:2.1.6.RELEASE] at org.springframework.data.mongodb.core.MongoTemplate.doInsert(MongoTemplate.java:1244) ~[spring-data-mongodb-2.1.6.RELEASE.jar:2.1.6.RELEASE] at org.springframework.data.mongodb.core.MongoTemplate.insert(MongoTemplate.java:1178) ~[spring-data-mongodb-2.1.6.RELEASE.jar:2.1.6.RELEASE] at org.springframework.data.mongodb.core.MongoTemplate.insert(MongoTemplate.java:1163) ~[spring-data-mongodb-2.1.6.RELEASE.jar:2.1.6.RELEASE] at com.dzl.activemqservice.mongoDB.MongoDB.test(MongoDB.java:46) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_71] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_71] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_71] at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_71] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.17.jar:9.0.17] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200) ~[tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) [tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) [tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) [tomcat-embed-core-9.0.17.jar:9.0.17] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.17.jar:9.0.17] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_71] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_71] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.17.jar:9.0.17] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_71] 求大佬解答
Spring集成mongodb MongoTemplate 查询
第一次用Spring集成mongodb,这个数据属性太多了,我想查到该条数据之后,我只想要它返回"general"这个属性和他的子属性映射到一个实体类如下图,那个类业之后general子属性中那些属性。怎么做? ![CSDN移动问答][1] ![CSDN移动问答][2] [1]: http://img.my.csdn.net/uploads/201405/27/1401195996_7137.png [2]: http://img.my.csdn.net/uploads/201405/27/1401196227_1582.png
springboot 项目使用mongotemplate 查询mongo数据库,查询字段和Java实体bean不匹配。
springboot 项目使用mongotemplate 查询mongo数据库,查询字段和Java实体bean不匹配。 项目mongo数据库中使用的字段是首字母大写的。 ``` 其中某一条记录 { "_id" : ObjectId("5cdb896d20157b3976996d9b"), "Date" : "2019-07-77", "IP" : "11.11.111.111", "SessionID" : "136****888", "StartTime" : "14:37:06" } ``` 定义的实体类: ``` @Data @Document(collection = "AFVRT") public class AFVRT { @Id private String id; @Field("Date") private String Date; @Field("IP") private String IP; @Field("SessionID") private String SessionID; @Field("StartTime") private String StartTime; @Field("EndTime") private String EndTime; } ``` 查询方法: ``` public class FaceSystemAfvController { @Autowired private MongoTemplate mongoTemplate; @Autowired private StringRedisTemplate stringRedisTemplate; @RequestMapping("/sayHello") public String sayHello() throws ParseException { Query query = new Query(); query = new Query(Criteria.where("SessionID").is("AFV2464F31B000089A3")); List<AFVRT> list = mongoServerTemplate.find(query, AFVRT.class); return "Hello World"; } } ``` 报错如下: ``` 2019-05-28 17:25:17.219 ERROR 14964 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.mapping.context.InvalidPersistentPropertyPath: No property sessionID found on com.logapi.logapifacesystem.api.afv.model.AFVRT!] with root cause org.springframework.data.mapping.context.InvalidPersistentPropertyPath: No property sessionID found on com.logapi.logapifacesystem.api.afv.model.AFVRT! at org.springframework.data.mapping.context.AbstractMappingContext.createPersistentPropertyPath(AbstractMappingContext.java:318) ~[spring-data-commons-2.0.9.RELEASE.jar:2.0.9.RELEASE] at org.springframework.data.mapping.context.AbstractMappingContext.lambda$getPersistentPropertyPath$1(AbstractMappingContext.java:287) ~[spring-data-commons-2.0.9.RELEASE.jar:2.0.9.RELEASE] at java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:324) ~[na:1.8.0_191] at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentPropertyPath(AbstractMappingContext.java:286) ~[spring-data-commons-2.0.9.RELEASE.jar:2.0.9.RELEASE] at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentPropertyPath(AbstractMappingContext.java:259) ~[spring-data-commons-2.0.9.RELEASE.jar:2.0.9.RELEASE] at org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.getPath(QueryMapper.java:937) ~[spring-data-mongodb-2.0.9.RELEASE.jar:2.0.9.RELEASE] at org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.<init>(QueryMapper.java:820) ~[spring-data-mongodb-2.0.9.RELEASE.jar:2.0.9.RELEASE] at org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.<init>(QueryMapper.java:797) ~[spring-data-mongodb-2.0.9.RELEASE.jar:2.0.9.RELEASE] at org.springframework.data.mongodb.core.convert.QueryMapper.createPropertyField(QueryMapper.java:245) ~[spring-data-mongodb-2.0.9.RELEASE.jar:2.0.9.RELEASE] at org.springframework.data.mongodb.core.convert.QueryMapper.getMappedObject(QueryMapper.java:139) ~[spring-data-mongodb-2.0.9.RELEASE.jar:2.0.9.RELEASE] at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:2237) ~[spring-data-mongodb-2.0.9.RELEASE.jar:2.0.9.RELEASE] at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:2227) ~[spring-data-mongodb-2.0.9.RELEASE.jar:2.0.9.RELEASE] at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:770) ~[spring-data-mongodb-2.0.9.RELEASE.jar:2.0.9.RELEASE] at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:756) ~[spring-data-mongodb-2.0.9.RELEASE.jar:2.0.9.RELEASE] at com.logapi.logapifacesystem.api.afv.controller.FaceSystemAfvController.sayHello(FaceSystemAfvController.java:69) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_191] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_191] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_191] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) ~[spring-web-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) ~[spring-web-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.32.jar:8.5.32] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) ~[spring-web-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) [tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800) [tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:800) [tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1471) [tomcat-embed-core-8.5.32.jar:8.5.32] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.32.jar:8.5.32] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_191] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_191] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.32.jar:8.5.32] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_191] ``` 说明: 1,如果将实体类属性字段改成首字母小写,则不会报错。 2,去掉实体类属性的gei,set方法也不会报错 3,查询时不传入条件,直接查询所有的话也不会报错 百度找了几天也没找到答案,希望大神可以帮帮忙!!!!!!!
springbootl配置MongoDB启动报MongoTemplate无法找到的错误
springbootl配置MongoDB后,启动程序报如下错误,在网上查了下感觉配置没什么问题,不知道什么原因,求大神帮忙解答 ![图片说明](https://img-ask.csdn.net/upload/201809/19/1537324711_247369.png) 配置如下 ![图片说明](https://img-ask.csdn.net/upload/201809/19/1537324719_763702.png) ![图片说明](https://img-ask.csdn.net/upload/201809/19/1537324747_727535.png)
MongoTemplate().aggregate()做聚合查询返回结果不对
上代码: Criteria c = Criteria.where("storeId") .is(hotelId) .and("bussDate") .gte(startDate) .lt(endDate); if(t == 1){ c.and("dishAttr").nin(372); }else{ c.and("dishAttr").nin(373); } //Query q = new Query(c); if(pageNum == 1){ pageNum -= 1; }else{ pageSize = pageSize * pageNum; pageNum = (pageNum - 1) * 20; } //q.skip(pageNum).limit(pageSize); Aggregation aggregation = Aggregation.newAggregation( Aggregation.match(c), Aggregation.group("dishName").sum("makeNum").as("makeNum").sum("makeAmount").as("makeAmount"), Aggregation.skip(pageNum), Aggregation.limit(pageSize) ); System.out.println("--mongoDBSQL--"+aggregation.toString()); AggregationResults<RptDailyDishSale> aggRes = this.getMongoTemplate().aggregate(aggregation, "rptDailyDishSale", RptDailyDishSale.class); List<RptDailyDishSale> listRes = aggRes.getMappedResults(); for (RptDailyDishSale rptDailyDishSale : listRes) { System.out.println("--菜类名称:--"+rptDailyDishSale.getSortName()+"--菜品名称:--"+rptDailyDishSale.getDishNam()); //**问题来了!!!!!** 打印的rptDailyDishSale.getDishNam() 名称是 null debug的时候 截图如下 ![图片说明](https://img-ask.csdn.net/upload/201602/19/1455863480_211441.jpg) } return listRes; 打印出来的sql语句 ---------------------------------- --mongoDBSQL--{ "aggregate" : "__collection__" , "pipeline" : [ { "$match" : { "storeId" : "14e714b8-8c68-445c-a74a-3cc5a13afef2" , "bussDate" : { "$gte" : "2016-02-18" , "$lt" : "2016-02-19"} , "dishAttr" : { "$nin" : [ 373]}}} , { "$group" : { "_id" : "$dishName" , "makeNum" : { "$sum" : "$makeNum"} , "makeAmount" : { "$sum" : "$makeAmount"}}} , { "$skip" : 0} , { "$limit" : 20}]}
Spring Data jpa+Mongodb查询全部数据出错
代码: List<Comment> comments = commentDao.findAll(); findAll为继承自MongoRepository的方法 报错: Caused by: com.mongodb.MongoQueryException: Query failed with error code 2 and error message 'Field 'locale' is invalid in: { locale: "comment" }' on server localhost:27017 at com.mongodb.operation.FindOperation$1.call(FindOperation.java:735) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:725) at com.mongodb.operation.OperationHelper.withReadConnectionSource(OperationHelper.java:463) at com.mongodb.operation.FindOperation.execute(FindOperation.java:725) at com.mongodb.operation.FindOperation.execute(FindOperation.java:89) at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:189) at com.mongodb.client.internal.MongoIterableImpl.execute(MongoIterableImpl.java:143) at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:92) at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:2793) ... 86 more 试过换工程、换数据库、换表、换版本,依旧没有解决,而且几乎搜不到这个错误。
通过xml 配置bean连接mongodb,如何关闭mongodb的连接
<bean id="mongo" class="org.springframework.data.mongodb.core.MongoFactoryBean"> <property name="host" value="192.168.1.202" /> </bean> <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"> <constructor-arg name="mongo" ref="mongo" /> <constructor-arg name="databaseName" value="crawler_v2"/> </bean> 这是我的配置文件,通过 @Autowired private MongoTemplate mongoTemplate; 这种方式注入到service中, 请问 这个bean何时销毁,销毁的时候mongobd的数据库连接会断开么?我如何直接手动断开连接?
现在是一些关键操作要记录操作日志,但是在insert的时候,偶然会出现插入失败的问题.现在找不到问题所在?
执行代码 ``` HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); SsOperLog ssOperLogEntity = new SsOperLog(); ssOperLogEntity.setOperNo(Long.valueOf(IdGenarater.nextStringValue()));//操作流水号 UserInfo users = Util.getSessionUserInfo(request);//登录用户 if (users == null) {//用户还未登录 String workCode = request.getParameter("workCode"); String urlString = request.getHeader("host"); //根据域名获取部门编号 String deptCode = loginService.getDeptCodeByDomainName(urlString); users = loginService.selectByUserIdAndPassword(workCode, null, deptCode); if (users == null) { return point.proceed(); } } ssOperLogEntity.setDeptCode(users.getDeptCode());//用户机构 ssOperLogEntity.setOperId(Long.valueOf(users.getOperId()));//用户id ssOperLogEntity.setOperName(users.getOperName());//操作员 ssOperLogEntity.setDeptName(users.getDeptName()); ssOperLogEntity.setOperDate(new Date(System.currentTimeMillis()));//操作日期 ssOperLogEntity.setOperTime(new Date(System.currentTimeMillis()));//操作时间 String rquestName = getMthodRemark(point);//操作名称(对应注解里面的remark信息) String operType = getMthodOperType(point);//操作类型(对应注解里面的opertype信息) String processMethod = point.getSignature().getName();//请求处理方法名 ssOperLogEntity.setReruestId(request.getRequestURI());//请求url ssOperLogEntity.setRquestName(rquestName); if(operType.length()>1){ //获取大类类型 ssOperLogEntity.setCategories(operType.substring(0,1)); } ssOperLogEntity.setProcessMethod(processMethod); ssOperLogEntity.setOperType(operType); ssOperLogEntity.setLocalAddress(request.getRemoteAddr()); if (!"/aa/login/checkLogin.do".equals(request.getRequestURI())) { String requestParams = JSONObject.toJSONString(request.getParameterMap()); ssOperLogEntity.setRequestParams(requestParams); }//请求参数 Object[] method_param = null; Object object; try { method_param = point.getArgs(); //获取方法参数 object = point.proceed(); } catch (Exception e) { ssOperLogEntity.setOperState(OperateStatusEnum.FAIL.getCode());//操作失败 ssOperLogEntity.setExceptionMesg(e.getMessage()); if (e.getMessage() == null) { ssOperLogEntity.setExceptionMesg(e.toString()); } mongoTemplate.insert(ssOperLogEntity); // ssOperLogMapper.insert(ssOperLogEntity); throw e; } ssOperLogEntity.setOperState(OperateStatusEnum.SUCC.getCode());//操作成功 mongoTemplate.insert(ssOperLogEntity); // 这里报错 // ssOperLogMapper.insert(ssOperLogEntity); return object; } ``` 异常信息:appserver-b4 等同于ip地址 ``` org.springframework.dao.DataAccessResourceFailureException: Operation on server appserver-b4:27017 failed; nested exception is com.mongodb.MongoException$Network: Operation on server appserver-b4:27017 failed at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:77) ~[spring-data-mongodb-1.10.15.RELEASE.jar:na] at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2128) ~[spring-data-mongodb-1.10.15.RELEASE.jar:na] at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:461) ~[spring-data-mongodb-1.10.15.RELEASE.jar:na] at org.springframework.data.mongodb.core.MongoTemplate.insertDBObject(MongoTemplate.java:1026) ~[spring-data-mongodb-1.10.15.RELEASE.jar:na] at org.springframework.data.mongodb.core.MongoTemplate.doInsert(MongoTemplate.java:835) ~[spring-data-mongodb-1.10.15.RELEASE.jar:na] at org.springframework.data.mongodb.core.MongoTemplate.insert(MongoTemplate.java:776) ~[spring-data-mongodb-1.10.15.RELEASE.jar:na] at org.springframework.data.mongodb.core.MongoTemplate.insert(MongoTemplate.java:767) ~[spring-data-mongodb-1.10.15.RELEASE.jar:na] at com.wx.app.ygp.service.log.LogService.doBefore(LogService.java:115) ~[classes/:na] at sun.reflect.GeneratedMethodAccessor867.invoke(Unknown Source) ~[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_162] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_162] at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:654) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE] at com.wx.app.ygp.action.system.LoginController$$EnhancerBySpringCGLIB$$3d4c3a49.checkLogin(<generated>) ~[classes/:na] at sun.reflect.GeneratedMethodAccessor1317.invoke(Unknown Source) ~[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_162] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_162] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222) ~[spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) ~[spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) [servlet-api.jar:na] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [servlet-api.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-websocket.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) [spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:167) [spring-session-1.3.1.RELEASE.jar:na] at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80) [spring-session-1.3.1.RELEASE.jar:na] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) [spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) [spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.44] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.44] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [catalina.jar:8.0.44] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94) [catalina.jar:8.0.44] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) [catalina.jar:8.0.44] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [catalina.jar:8.0.44] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:8.0.44] at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620) [catalina.jar:8.0.44] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.44] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502) [catalina.jar:8.0.44] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132) [tomcat-coyote.jar:8.0.44] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684) [tomcat-coyote.jar:8.0.44] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533) [tomcat-coyote.jar:8.0.44] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489) [tomcat-coyote.jar:8.0.44] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_162] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_162] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.44] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162] Caused by: com.mongodb.MongoException$Network: Operation on server appserver-b4:27017 failed at com.mongodb.DBTCPConnector.doOperation(DBTCPConnector.java:215) ~[mongo-java-driver-2.14.3.jar:na] at com.mongodb.DBCollectionImpl.writeWithCommandProtocol(DBCollectionImpl.java:567) ~[mongo-java-driver-2.14.3.jar:na] at com.mongodb.DBCollectionImpl.insertWithCommandProtocol(DBCollectionImpl.java:528) ~[mongo-java-driver-2.14.3.jar:na] at com.mongodb.DBCollectionImpl.insertImpl(DBCollectionImpl.java:206) ~[mongo-java-driver-2.14.3.jar:na] at com.mongodb.DBCollection.insert(DBCollection.java:176) ~[mongo-java-driver-2.14.3.jar:na] at com.mongodb.DBCollection.insert(DBCollection.java:93) ~[mongo-java-driver-2.14.3.jar:na] at com.mongodb.DBCollection.insert(DBCollection.java:78) ~[mongo-java-driver-2.14.3.jar:na] at com.mongodb.DBCollection.insert(DBCollection.java:120) ~[mongo-java-driver-2.14.3.jar:na] at org.springframework.data.mongodb.core.MongoTemplate$9.doInCollection(MongoTemplate.java:1031) ~[spring-data-mongodb-1.10.15.RELEASE.jar:na] at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:459) ~[spring-data-mongodb-1.10.15.RELEASE.jar:na] ... 63 common frames omitted Caused by: java.net.SocketException: Broken pipe (Write failed) at java.net.SocketOutputStream.socketWrite0(Native Method) ~[na:1.8.0_162] at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111) ~[na:1.8.0_162] at java.net.SocketOutputStream.write(SocketOutputStream.java:155) ~[na:1.8.0_162] at org.bson.io.PoolOutputBuffer.pipe(PoolOutputBuffer.java:153) ~[mongo-java-driver-2.14.3.jar:na] at com.mongodb.DBCollectionImpl.sendWriteCommandMessage(DBCollectionImpl.java:639) ~[mongo-java-driver-2.14.3.jar:na] at com.mongodb.DBCollectionImpl.access$300(DBCollectionImpl.java:50) ~[mongo-java-driver-2.14.3.jar:na] at com.mongodb.DBCollectionImpl$4.execute(DBCollectionImpl.java:576) ~[mongo-java-driver-2.14.3.jar:na] at com.mongodb.DBCollectionImpl$4.execute(DBCollectionImpl.java:567) ~[mongo-java-driver-2.14.3.jar:na] at com.mongodb.DBPort.doOperation(DBPort.java:187) ~[mongo-java-driver-2.14.3.jar:na] at com.mongodb.DBTCPConnector.doOperation(DBTCPConnector.java:208) ~[mongo-java-driver-2.14.3.jar:na] ... 72 common frames omitted ``` 配置MongoDB文件: ``` mongo.hostport=127.0.0.1:27017 mongo.connectionsPerHost=100 mongo.threadsAllowedToBlockForConnectionMultiplier=6 mongo.dataName=ygp mongo.username=ygp mongo.password=ygp_admin mongo.connectTimeout=60000 mongo.maxWaitTime=120000 mongo.autoConnectRetry=true mongo.socketKeepAlive=true mongo.socketTimeout=1500 mongo.slaveOk=true <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mongo="http://www.springframework.org/schema/data/mongo" xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <!--设置用户验证--> <bean id="userCredentials" class="org.springframework.data.authentication.UserCredentials"> <constructor-arg name="username" value="${mongo.username}" /> <constructor-arg name="password" value="${mongo.password}" /> </bean> <!-- 定义mongo对象,对应的是mongodb官方jar包中的Mongo,replica-set设置集群副本的ip地址和端口 --> <mongo:mongo id="mongo" replica-set="${mongo.hostport}"> <!-- 一些连接属性的设置 --> <mongo:options connections-per-host="${mongo.connectionsPerHost}" threads-allowed-to-block-for-connection-multiplier="${mongo.threadsAllowedToBlockForConnectionMultiplier}" connect-timeout="${mongo.connectTimeout}" max-wait-time="${mongo.maxWaitTime}" auto-connect-retry="${mongo.autoConnectRetry}" socket-keep-alive="${mongo.socketKeepAlive}" socket-timeout="${mongo.socketTimeout}" slave-ok="${mongo.slaveOk}" write-number="1" write-timeout="0" write-fsync="true" /> </mongo:mongo> <!-- mongo的工厂,通过它来取得mongo实例,dbname为mongodb的数据库名,没有的话会自动创建 --> <bean id="mongoDbFactory" class="org.springframework.data.mongodb.core.SimpleMongoDbFactory"> <constructor-arg ref="mongo" /> <constructor-arg value="${mongo.dataName}" /> <constructor-arg ref="userCredentials" /> </bean> <bean id="mappingContext" class="org.springframework.data.mongodb.core.mapping.MongoMappingContext" /> <!--排除 _class --> <bean id="defaultMongoTypeMapper" class="org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper"> <constructor-arg name="typeKey"> <null /> </constructor-arg> </bean> <!-- collection的映射 --> <bean id="mappingMongoConverter" class="org.springframework.data.mongodb.core.convert.MappingMongoConverter"> <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" /> <constructor-arg name="mappingContext" ref="mappingContext" /> <property name="typeMapper" ref="defaultMongoTypeMapper" /> </bean> <!-- mongodb的主要操作对象,所有对mongodb的增删改查的操作都是通过它完成 --> <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"> <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" /> <constructor-arg name="mongoConverter" ref="mappingMongoConverter" /> </bean> </beans> ```
mongodb的ID为String类型查询时的问题
mongodb的ID为String("102a1ds0as",不是正常的数字)类型,注意不是ObjectId,在用mongoTemplate.findAll()查询时虽然ID的字符串是一模一样,但只要mongodb的ID为string类型就是查询不出来,ObjectId类型的都可以,请问怎么处理
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载 点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。 ...
字节跳动视频编解码面经
三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时想着能进去就不错了,管他哪个岗呢,就同意了面试...
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
Python 基础(一):入门必备知识
Python 入门必备知识,你都掌握了吗?
兼职程序员一般可以从什么平台接私活?
这个问题我进行了系统性的总结,以下将进行言简意赅的说明和渠道提供,希望对各位小猿/小媛们有帮助~ 根据我们的经验,程序员兼职主要分为三种:兼职职位众包、项目整包和自由职业者驻场。 所谓的兼职职位众包,指的是需求方这边有自有工程师配合,只需要某个职位的工程师开发某个模块的项目。比如开发一个 app,后端接口有人开发,但是缺少 iOS 前端开发工程师,那么他们就会发布一个职位招聘前端,来配合公司一...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
写了很久,这是一份最适合/贴切普通大众/科班/非科班的『学习路线』
说实话,对于学习路线这种文章我一般是不写的,大家看我的文章也知道,我是很少写建议别人怎么样怎么样的文章,更多的是,写自己的真实经历,然后供大家去参考,这样子,我内心也比较踏实,也不怕误导他人。 但是,最近好多人问我学习路线,而且很多大一大二的,说自己很迷茫,看到我那篇 普普通通,我的三年大学 之后很受激励,觉得自己也能行,(是的,别太浪,你一定能行)希望我能给他个学习路线,说...
经典算法(5)杨辉三角
写在前面: 我是 扬帆向海,这个昵称来源于我的名字以及女朋友的名字。我热爱技术、热爱开源、热爱编程。技术是开源的、知识是共享的。 这博客是对自己学习的一点点总结及记录,如果您对 Java、算法 感兴趣,可以关注我的动态,我们一起学习。 用知识改变命运,让我们的家人过上更好的生活。 目录一、杨辉三角的介绍二、杨辉三角的算法思想三、代码实现1.第一种写法2.第二种写法 一、杨辉三角的介绍 百度
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,
程序员:我终于知道post和get的区别
IT界知名的程序员曾说:对于那些月薪三万以下,自称IT工程师的码农们,其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居,但只是他们一厢情愿罢了。 此话一出,不知激起了多少(码农)程序员的愤怒,却又无可奈何,于是码农问程序员。 码农:你知道get和post请求到底有什么区别? 程序员:你看这篇就知道了。 码农:你月薪三万了? 程序员:嗯。 码农:你是怎么做到的? 程序员:
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI 算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
面试官如何考察你的思维方式?
1.两种思维方式在求职面试中,经常会考察这种问题:北京有多少量特斯拉汽车? 某胡同口的煎饼摊一年能卖出多少个煎饼? 深圳有多少个产品经理? 一辆公交车里能装下多少个乒乓球? 一
碎片化的时代,如何学习
今天周末,和大家聊聊学习这件事情。 在如今这个社会,我们的时间被各类 APP 撕的粉碎。 刷知乎、刷微博、刷朋友圈; 看论坛、看博客、看公号; 等等形形色色的信息和知识获取方式一个都不错过。 貌似学了很多,但是却感觉没什么用。 要解决上面这些问题,首先要分清楚一点,什么是信息,什么是知识。 那什么是信息呢? 你一切听到的、看到的,都是信息,比如微博上的明星出轨、微信中的表情大战、抖音上的...
so easy! 10行代码写个"狗屁不通"文章生成器
前几天,GitHub 有个开源项目特别火,只要输入标题就可以生成一篇长长的文章。 背后实现代码一定很复杂吧,里面一定有很多高深莫测的机器学习等复杂算法 不过,当我看了源代码之后 这程序不到50行 尽管我有多年的Python经验,但我竟然一时也没有看懂 当然啦,原作者也说了,这个代码也是在无聊中诞生的,平时撸码是不写中文变量名的, 中文...
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的回答,对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalking,作者吴晟、刘浩杨 等等 仓库地址: apache/skywalking 更...
相关热词 c# plc s1200 c#里氏转换原则 c# 主界面 c# do loop c#存为组套 模板 c# 停掉协程 c# rgb 读取图片 c# 图片颜色调整 最快 c#多张图片上传 c#密封类与密封方法
立即提问