某南京双非的面经:
最近投了爱奇艺的java实习,在途牛旅游网实习过一段时间。
1、一开始自我介绍,然后问我做过哪些项目,我只介绍了其中一个。
2、项目里的redis处理并发问题的根据是什么?
你用 SQL 数据库的话,可以用事务来解决。但是你这么高的并发交给数据库显然会太慢。Redis 作为内存数据库,实现得又好,所以速度飞快。然后呢,解决竞态,还是靠人来编程解决。Redis 只是提供了足以解决问题的工具。
redis中也是有事务的,不过这个事务没有mysql中的完善,只保证了一致性和隔离性,不满足原子性和持久性。
redis事务使用multi、exec命令
3、redis知道哪些数据类型?spring里怎么用redis? Jeddis
Redis是一种基于客户端-服务端模型以及请求/响应协议的TCP服务。这意味着通常情况下一个请求会遵循以下步骤:
- 客户端向服务端发送一个查询请求,并监听Socket返回,通常是以阻塞模式,等待服务端响应。
- 服务端处理命令,并将结果返回给客户端。
new RedisClient(){private Jedis jedis;//非切片额客户端连接
private JedisPool jedisPool;//非切片连接池
private ShardedJedis shardedJedis;//切片额客户端连接
private ShardedJedisPool shardedJedisPool;//切片连接池
}
4、紧接着开始问我spring的问题,解释IOC的原理,有哪些创建Bean的方式,xml配置和java配置是否可以同时存在,为什么?
5、aop的原理,什么是静态织入和动态织入?
6、restful api了解不,说说get,put,post,delete的区别?
7、你的项目里为什么都用post,有什么好处,处理json字符串的jar包是什么?其中org.json和json-lib比较简单
8、用过springboot吗?(没用过)springmvc的配置,有什么好处?servlet的原理,jdbc连接数据库。
9、mybatis的原理,如何实现?
10、数据库的事务隔离级别,什么是脏读,幻读?
11、数据库索引的原理是什么?B树和B+树有什么区别?什么是红黑树?有哪些索引?可不可以同时在一张表设置多个索引(n个)?索引的优缺点?一张性别表和一张学号表,哪个适合建索引?为什么?
12、数据库事务,spring事务如何实现?
13、看你项目里自己写过react和vue,接着开始问我前端,(很慌)。react和vue,angular的区别是什么?什么是虚拟DOM,vue的父子组件如何联系?什么是双向绑定,react如何实现双向绑定?会不会react redux,vuex?(这里不怎么说的清楚,很乱)
14、知道ES6吗,var和let区别,没有let,怎么处理var的问题(闭包和IIFE)?const?箭头函数?
15、样式会不会?什么是flex?为什么要用?如何实现左边固定,右边自适应?如何实现垂直水平居中?
16、还有一些问题记不大清了,庆幸没问算法。。。过了一个小时二面的面试官打电话过来直接就说一面的面试官对我很满意,他就不问了,有点开心,然后开始询问我一些问题,最近的情况,考虑转正的问题不?,可不可以全职?
17.IOC用到的设计模式:模板模式,单例模式,工厂模式
18.dubbo
19.@autireware和resource的区别:spring propertiey注入,搜索先后顺序不一样。
@Resource will narrow down the search first by name then by type and finally by Qualifiers (ignored if match is found by name). @Autowired and @Inject will narrow down the search first by type then by qualifier and finally by the name.
20.Mysql索引有哪些:单列索引,组合索引(clustered index)
创建索引时,你需要确保该索引是应用在SQL 查询语句的条件(一般作为 WHERE 子句的条件)。
MySQL里的索引类型主要有以下几种。
- B-Tree索引
最常见的索引类型,基于B-Tree数据结构。B-Tree的基本思想是,所有值(被索引的列)都是排过序的,每个叶节点到跟节点距离相等。所以B-Tree适合用来查找某一范围内的数据,而且可以直接支持数据排序(ORDER BY)。但是当索引多列时,列的顺序特别重要,需要格外注意。InnoDB和MyISAM都支持B-Tree索引。InnoDB用的是一个变种B+Tree,而MyISAM为了节省空间对索引进行了压缩,从而牺牲了性能。 - Hash索引
基于hash表。所以这种索引只支持精确查找,不支持范围查找,不支持排序。这意味着范围查找或ORDER BY都要依赖server层的额外工作。目前只有Memory引擎支持显式的hash索引(但是它的hash是nonunique的,冲突太多时也会影响查找性能)。Memory引擎默认的索引类型即是Hash索引,虽然它也支持B-Tree索引。
3.Full-text索引
主要用来查找文本中的关键字,而不是直接与索引中的值相比较。Full-text索引跟其它索引大不相同,它更像是一个搜索引擎,而不是简单的WHERE语句的参数匹配。你可以对某列分别进行full-text索引和B-Tree索引,两者互不冲突。Full-text索引配合MATCH AGAINST操作使用,而不是一般的WHERE语句加LIKE。
哪个数据库引擎?
Innodb,做事务