Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c14676e
Create SpringInterviewQuestions.md
Snailclimb May 30, 2019
94021ed
Update README.md
Snailclimb May 30, 2019
569d73d
修复图片链接失效问题
Snailclimb May 30, 2019
6a3c5b9
修复图片链接
Snailclimb May 30, 2019
8a173a0
Update README.md
Snailclimb May 30, 2019
149c64b
[RocketMQ-Questions.md] 补充顺序消费以及 Broker 的 Raft 选举特性
May 30, 2019
58bb96f
Update JavaConcurrencyAdvancedCommonInterviewQuestions.md
Snailclimb Jun 1, 2019
5e268c7
Merge pull request #335 from LiWenGu/master
Snailclimb Jun 1, 2019
52fb679
Update 几道常见的链表算法题.md
Snailclimb Jun 1, 2019
de1beb7
Update Java集合框架常见面试题.md
Snailclimb Jun 5, 2019
3089b0a
Update 计算机网络.md
Snailclimb Jun 5, 2019
afe39e7
Create 2019-5.md
Snailclimb Jun 7, 2019
a00c739
Update 事务隔离级别(图文详解).md
Snailclimb Jun 11, 2019
732950e
Update README.md
Snailclimb Jun 11, 2019
f771f27
Update README.md
Snailclimb Jun 11, 2019
1d8787a
Update Java基础知识.md
Snailclimb Jun 12, 2019
8af50f3
Update JavaConcurrencyAdvancedCommonInterviewQuestions.md
Snailclimb Jun 13, 2019
915d4a2
Update Java基础知识.md
Snailclimb Jun 15, 2019
6479908
Update J2EE基础知识.md
Snailclimb Jun 15, 2019
40cda29
Update README.md
Snailclimb Jun 16, 2019
7a7b6a4
Update:optimize content
Snailclimb Jun 17, 2019
db8807e
Update:optimize content
Snailclimb Jun 17, 2019
c4b9ca7
Update JavaConcurrencyBasicsCommonInterviewQuestionsSummary.md
Snailclimb Jun 17, 2019
bb148aa
Update JavaConcurrencyBasicsCommonInterviewQuestionsSummary.md
Snailclimb Jun 17, 2019
6990d76
Update:optimize content
Snailclimb Jun 17, 2019
96aaee0
Update JavaConcurrencyBasicsCommonInterviewQuestionsSummary.md
Snailclimb Jun 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,10 @@

<p align="center">
<a href="https://coding.net/?utm_source=JavaGuide" target="_blank">
<img src="http://pqrlmrv7w.bkt.clouddn.com/img/2019-4/006rNwoDgy1g2dw5gau7nj30eg02vwfr.jpg" width="390px"/>
<img src="https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-6/006rNwoDgy1g2dw5gau7nj30eg02vwfr.jpg" width="390px"/>
</a>
<a href="http://www.lubanjava.com/luban/index.html?=javaguide
" target="_blank">
<img src="http://pqrlmrv7w.bkt.clouddn.com/img/2019-4/QQ图片20190514211856.gif" width="390px"/>
</a>
</p>


推荐使用 <https://snailclimb.top/JavaGuide/> 在线阅读(访问速度慢的话,请使用 <https://snailclimb.gitee.io/javaguide> ),在线阅读内容本仓库同步一致。这种方式阅读的优势在于:有侧边栏阅读体验更好,Gitee pages 的访问速度相对来说也比较快。
推荐使用 https://snailclimb.top/JavaGuide/ 在线阅读(访问速度慢的话,请使用 https://snailclimb.gitee.io/javaguide ),在线阅读内容本仓库同步一致。这种方式阅读的优势在于:有侧边栏阅读体验更好,Gitee pages 的访问速度相对来说也比较快。

## 目录

Expand Down Expand Up @@ -168,6 +162,7 @@
#### Spring

- [Spring 学习与面试](docs/system-design/framework/spring/Spring.md)
- [Spring 常见问题总结](docs/system-design/framework/spring/SpringInterviewQuestions.md)
- [Spring中bean的作用域与生命周期](docs/system-design/framework/spring/SpringBean.md)
- [SpringMVC 工作原理详解](docs/system-design/framework/spring/SpringMVC-Principle.md)
- [Spring中都用到了那些设计模式?](docs/system-design/framework/spring/Spring-Design-Patterns.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public class Solution {
while (node1 != null) {
node1 = node1.next;
count++;
if (k < 1 && node1 != null) {
if (k < 1) {
node2 = node2.next;
}
k--;
Expand Down
5 changes: 2 additions & 3 deletions docs/database/事务隔离级别(图文详解).md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@

### 事物的特性(ACID)

<div align="center">
<img src="https://user-gold-cdn.xitu.io/2018/5/20/1637b08b98619455?w=312&h=305&f=png&s=22430" width="200px"/>
</div>
![事物的特性](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-6/事务特性.png)


1. **原子性:** 事务是最小的执行单位,不允许分割。事务的原子性确保动作要么全部完成,要么完全不起作用;
2. **一致性:** 执行事务前后,数据保持一致,多个事务对同一个数据读取的结果是相同的;
Expand Down
125 changes: 125 additions & 0 deletions docs/github-trending/2019-5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
以下涉及到的数据统计与 2019 年 6 月 1 日 18 点,数据来源:<https://github.com/trending/java?since=monthly> 。下面推荐的内容从 Java 学习文档到最热门的框架再到热门的工具应有尽有,建议收藏+在看!

### 1.LeetCodeAnimation

- **Github 地址**: <https://github.com/MisterBooo/LeetCodeAnimation>
- **Star**: 29.0k (11,492 stars this month)
- **介绍**: Demonstrate all the questions on LeetCode in the form of animation.(用动画的形式呈现解LeetCode题目的思路)。

### 2.CS-Notes

- **Github 地址**:<https://github.com/CyC2018/CS-Notes>
- **Star**: 64.4k (5513 stars this month)
- **介绍**: 技术面试必备基础知识、Leetcode 题解、后端面试、Java 面试、春招、秋招、操作系统、计算机网络、系统设计。

### 3.JavaGuide

- **Github 地址**:<https://github.com/Snailclimb/JavaGuide>
- **Star**: 42.0k (4,442 stars this month)
- **介绍**: 【Java 学习+面试指南】 一份涵盖大部分 Java 程序员所需要掌握的核心知识。

### 4.mall

- **Github 地址**: [https://github.com/macrozheng/mall](https://github.com/macrozheng/mall)
- **star**: 14.6 k (3,086 stars this month)
- **介绍**: mall 项目是一套电商系统,包括前台商城系统及后台管理系统,基于 SpringBoot+MyBatis 实现。 前台商城系统包含首页门户、商品推荐、商品搜索、商品展示、购物车、订单流程、会员中心、客户服务、帮助中心等模块。 后台管理系统包含商品管理、订单管理、会员管理、促销管理、运营管理、内容管理、统计报表、财务管理、权限管理、设置等模块。

### 5.advanced-java

- **Github 地址**:[https://github.com/doocs/advanced-java](https://github.com/doocs/advanced-java)
- **Star**: 20.8k (2,394 stars this month)
- **介绍**: 互联网 Java 工程师进阶知识完全扫盲。

### 6.spring-boot

- **Github地址**: [https://github.com/spring-projects/spring-boot](https://github.com/spring-projects/spring-boot)
- **star:** 38.5k (1,339 stars this month)
- **介绍**: 虽然Spring的组件代码是轻量级的,但它的配置却是重量级的(需要大量XML配置),不过Spring Boot 让这一切成为了过去。 另外Spring Cloud也是基于Spring Boot构建的,我个人非常有必要学习一下。

**Spring Boot官方的介绍:**

> Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”…Most Spring Boot applications need very little Spring configuration.(Spring Boot可以轻松创建独立的生产级基于Spring的应用程序,只要通过 “just run”(可能是run ‘Application’或java -jar 或 tomcat 或 maven插件run 或 shell脚本)便可以运行项目。大部分Spring Boot项目只需要少量的配置即可)

### 7. Java

- **Github 地址**:<https://github.com/TheAlgorithms/Java>
- **Star**:14.3k (1,334 stars this month)
- **介绍**: All Algorithms implemented in Java。

### 8.server

- **Github 地址**:<https://github.com/wildfirechat/server>
- **star**: 2.2 k (1,275 stars this month)
- **介绍**: 全开源即时通讯(IM)系统。

### 9.litemall

- **Github 地址**:<https://github.com/linlinjava/litemall>
- **Star**: 7.1k (1,114 stars this month)
- **介绍**: 又一个小商城。litemall = Spring Boot后端 + Vue管理员前端 + 微信小程序用户前端 + Vue用户移动端。

### 10.Linkage-RecyclerView

- **Github 地址**:<https://github.com/KunMinX/Linkage-RecyclerView>
- **Star**: 10.0k (1,093 stars this month)
- **介绍**: 即使不用饿了么订餐,也请务必收藏好该库!🔥 一行代码即可接入,二级联动订餐列表 - Even if you don't order food by PrubHub, be sure to collect this library, please! 🔥 This secondary linkage list widget can be accessed by only one line of code. Supporting by RecyclerView & AndroidX.

### 11.toBeTopJavaer

- **Github 地址** : <https://github.com/hollischuang/toBeTopJavaer>
- **Star**: 3.3k (1,007 stars this month)
- **介绍**: To Be Top Javaer - Java工程师成神之路

### 12.elasticsearch

- **Github 地址** : [https://github.com/elastic/elasticsearch](https://github.com/elastic/elasticsearch)
- **Star**: 48.0k (968 stars this month)
- **介绍**: Design patterns implemented in Java。

### 13.java-design-patterns

- **Github 地址** : <https://github.com/iluwatar/java-design-patterns>
- **Star**: 41.5k (955 stars this month)
- **介绍**: 开源,分布式,RESTful 搜索引擎。

### 14.apollo

- **Github 地址** : <https://github.com/ctripcorp/apollo>
- **Star**: 14.5k (927 stars this month)
- **介绍**: Apollo(阿波罗)是携程框架部门研发的分布式配置中心,能够集中化管理应用不同环境、不同集群的配置,配置修改后能够实时推送到应用端,并且具备规范的权限、流程治理等特性,适用于微服务配置管理场景。

### 15.arthas

- **Github地址**:[https://github.com/alibaba/arthas](https://github.com/alibaba/arthas)
- **star**: 13.5 k (933 stars this month)
- **介绍**: Arthas 是Alibaba开源的Java诊断工具。

### 16.dubbo

- **Github地址**:<https://github.com/apache/dubbo>
- **star**: 26.9 k (769 stars this month)
- **介绍**: Apache Dubbo是一个基于Java的高性能开源RPC框架。

### 17.DoraemonKit

- **Github地址**: <https://github.com/didi/DoraemonKit>
- **Star**: 8.5k (909 stars this month)
- **介绍**: 简称 "DoKit" 。一款功能齐全的客户端( iOS 、Android )研发助手,你值得拥有。

### 18.halo

- **Github地址**: <https://github.com/halo-dev/halo>
- **Star**: 4.1k (829 stars this month)
- **介绍**: Halo 可能是最好的 Java 博客系统。

### 19.seata

- **Github 地址** : [https://github.com/seata/seata](https://github.com/seata/seata)
- **star**: 9.2 k (776 stars this month)
- **介绍**: Seata 是一种易于使用,高性能,基于 Java 的开源分布式事务解决方案。

### 20.hutool

- **Github地址**:<https://github.com/looly/hutool>
- **star**: 5,3 k (812 stars this month)
- **介绍**: Hutool是一个Java工具包,也只是一个工具包,它帮助我们简化每一行代码,减少每一个方法,让Java语言也可以“甜甜的”。Hutool最初是我项目中“util”包的一个整理,后来慢慢积累并加入更多非业务相关功能,并广泛学习其它开源项目精髓,经过自己整理修改,最终形成丰富的开源工具集。官网:<https://www.hutool.cn/> 。
50 changes: 28 additions & 22 deletions docs/java/J2EE基础知识.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

## Servlet总结

在Java Web程序中,**Servlet**主要负责接收用户请求**HttpServletRequest**,在**doGet()**,**doPost()**中做相应的处理,并将回应**HttpServletResponse**反馈给用户。Servlet可以设置初始化参数,供Servlet内部使用。一个Servlet类只会有一个实例,在它初始化时调用**init()方法**,销毁时调用**destroy()方法**。**Servlet需要在web.xml中配置**(MyEclipse中创建Servlet会自动配置),**一个Servlet可以设置多个URL访问**。**Servlet不是线程安全**,因此要谨慎使用类变量。
在Java Web程序中,**Servlet**主要负责接收用户请求 `HttpServletRequest`,在`doGet()`,`doPost()`中做相应的处理,并将回应`HttpServletResponse`反馈给用户。**Servlet** 可以设置初始化参数,供Servlet内部使用。一个Servlet类只会有一个实例,在它初始化时调用`init()`方法,销毁时调用`destroy()`方法**。**Servlet需要在web.xml中配置(MyEclipse中创建Servlet会自动配置),**一个Servlet可以设置多个URL访问**。**Servlet不是线程安全**,因此要谨慎使用类变量。

## 阐述Servlet和CGI的区别?

Expand Down Expand Up @@ -55,11 +55,11 @@
## Servlet接口中有哪些方法及Servlet生命周期探秘
Servlet接口定义了5个方法,其中**前三个方法与Servlet生命周期相关**:

- **void init(ServletConfig config) throws ServletException**
- **void service(ServletRequest req, ServletResponse resp) throws ServletException, java.io.IOException**
- **void destory()**
- java.lang.String getServletInfo()
- ServletConfig getServletConfig()
- `void init(ServletConfig config) throws ServletException`
- `void service(ServletRequest req, ServletResponse resp) throws ServletException, java.io.IOException`
- `void destory()`
- `java.lang.String getServletInfo()`
- `ServletConfig getServletConfig()`

**生命周期:** **Web容器加载Servlet并将其实例化后,Servlet生命周期开始**,容器运行其**init()方法**进行Servlet的初始化;请求到达时调用Servlet的**service()方法**,service()方法会根据需要调用与请求对应的**doGet或doPost**等方法;当服务器关闭或项目被卸载时服务器会将Servlet实例销毁,此时会调用Servlet的**destroy()方法**。**init方法和destroy方法只会执行一次,service方法客户端每次请求Servlet都会执行**。Servlet中有时会用到一些需要初始化与销毁的资源,因此可以把初始化资源的代码放入init方法中,销毁资源的代码放入destroy方法中,这样就不需要每次处理客户端的请求都要初始化与销毁资源。

Expand Down Expand Up @@ -143,13 +143,11 @@ Response.setHeader("Refresh","5;URL=http://localhost:8080/servlet/example.htm");
JSP是一种Servlet,但是与HttpServlet的工作方式不太一样。HttpServlet是先由源代码编译为class文件后部署到服务器下,为先编译后部署。而JSP则是先部署后编译。JSP会在客户端第一次请求JSP文件时被编译为HttpJspPage类(接口Servlet的一个子类)。该类会被服务器临时存放在服务器工作目录里面。下面通过实例给大家介绍。
工程JspLoginDemo下有一个名为login.jsp的Jsp文件,把工程第一次部署到服务器上后访问这个Jsp文件,我们发现这个目录下多了下图这两个东东。
.class文件便是JSP对应的Servlet。编译完毕后再运行class文件来响应客户端请求。以后客户端访问login.jsp的时候,Tomcat将不再重新编译JSP文件,而是直接调用class文件来响应客户端请求。
![JSP工作原理](https://user-gold-cdn.xitu.io/2018/3/31/1627bee073079a28?w=675&h=292&f=jpeg&s=133553)
![JSP工作原理](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-6/1.png)
由于JSP只会在客户端第一次请求的时候被编译 ,因此第一次请求JSP时会感觉比较慢,之后就会感觉快很多。如果把服务器保存的class文件删除,服务器也会重新编译JSP。

开发Web程序时经常需要修改JSP。Tomcat能够自动检测到JSP程序的改动。如果检测到JSP源代码发生了改动。Tomcat会在下次客户端请求JSP时重新编译JSP,而不需要重启Tomcat。这种自动检测功能是默认开启的,检测改动会消耗少量的时间,在部署Web应用的时候可以在web.xml中将它关掉。



参考:《javaweb整合开发王者归来》P97

## JSP有哪些内置对象、作用分别是什么
Expand Down Expand Up @@ -195,31 +193,31 @@ JSP有9个内置对象:
## request.getAttribute()和 request.getParameter()有何区别
**从获取方向来看:**

getParameter()是获取 POST/GET 传递的参数值;
`getParameter()`是获取 POST/GET 传递的参数值;

getAttribute()是获取对象容器中的数据值;
`getAttribute()`是获取对象容器中的数据值;

**从用途来看:**

getParameter用于客户端重定向时,即点击了链接或提交按扭时传值用,即用于在用表单或url重定向传值时接收数据用。
`getParameter()`用于客户端重定向时,即点击了链接或提交按扭时传值用,即用于在用表单或url重定向传值时接收数据用。

getAttribute用于服务器端重定向时,即在 sevlet 中使用了 forward 函数,或 struts 中使用了
`getAttribute()` 用于服务器端重定向时,即在 sevlet 中使用了 forward 函数,或 struts 中使用了
mapping.findForward。 getAttribute 只能收到程序用 setAttribute 传过来的值。

另外,可以用 setAttribute,getAttribute 发送接收对象.而 getParameter 显然只能传字符串。
setAttribute 是应用服务器把这个对象放在该页面所对应的一块内存中去,当你的页面服务器重定向到另一个页面时,应用服务器会把这块内存拷贝另一个页面所对应的内存中。这样getAttribute就能取得你所设下的值,当然这种方法可以传对象。session也一样,只是对象在内存中的生命周期不一样而已。getParameter只是应用服务器在分析你送上来的 request页面的文本时,取得你设在表单或 url 重定向时的值。
另外,可以用 `setAttribute()`,`getAttribute()` 发送接收对象.而 `getParameter()` 显然只能传字符串。
`setAttribute()` 是应用服务器把这个对象放在该页面所对应的一块内存中去,当你的页面服务器重定向到另一个页面时,应用服务器会把这块内存拷贝另一个页面所对应的内存中。这样`getAttribute()`就能取得你所设下的值,当然这种方法可以传对象。session也一样,只是对象在内存中的生命周期不一样而已。`getParameter()`只是应用服务器在分析你送上来的 request页面的文本时,取得你设在表单或 url 重定向时的值。

**总结:**

getParameter 返回的是String,用于读取提交的表单中的值;(获取之后会根据实际需要转换为自己需要的相应类型,比如整型,日期类型啊等等)
`getParameter()`返回的是String,用于读取提交的表单中的值;(获取之后会根据实际需要转换为自己需要的相应类型,比如整型,日期类型啊等等)

getAttribute 返回的是Object,需进行转换,可用setAttribute 设置成任意对象,使用很灵活,可随时用
`getAttribute()`返回的是Object,需进行转换,可用`setAttribute()`设置成任意对象,使用很灵活,可随时用

## include指令include的行为的区别
**include指令:** JSP可以通过include指令来包含其他文件。被包含的文件可以是JSP文件、HTML文件或文本文件。包含的文件就好像是该JSP文件的一部分,会被同时编译执行。 语法格式如下:
<%@ include file="文件相对 url 地址" %>

i**nclude动作:** <jsp:include>动作元素用来包含静态和动态的文件。该动作把指定文件插入正在生成的页面。语法格式如下:
i**nclude动作:** `<jsp:include>`动作元素用来包含静态和动态的文件。该动作把指定文件插入正在生成的页面。语法格式如下:
<jsp:include page="相对 URL 地址" flush="true" />

## JSP九大内置对象,七大动作,三大指令
Expand All @@ -232,11 +230,9 @@ JSP中的四种作用域包括page、request、session和application,具体来
- **session**代表与某个用户与服务器建立的一次会话相关的对象和属性。跟某个用户相关的数据应该放在用户自己的session中。
- **application**代表与整个Web应用程序相关的对象和属性,它实质上是跨越整个Web应用程序,包括多个页面、请求和会话的一个全局作用域。



## 如何实现JSP或Servlet的单线程模式
对于JSP页面,可以通过page指令进行设置。
<%@page isThreadSafe=”false”%>
`<%@page isThreadSafe=”false”%>`

对于Servlet,可以让自定义的Servlet实现SingleThreadModel标识接口。

Expand Down Expand Up @@ -300,4 +296,14 @@ Cookie 和 Session都是用来跟踪浏览器用户身份的会话方式,但

Cookie 数据保存在客户端(浏览器端),Session 数据保存在服务器端。

Cookie 存储在客户端中,而Session存储在服务器上,相对来说 Session 安全性更高。如果使用 Cookie 的一些敏感信息不要写入 Cookie 中,最好能将 Cookie 信息加密然后使用到的时候再去服务器端解密。
Cookie 存储在客户端中,而Session存储在服务器上,相对来说 Session 安全性更高。如果使用 Cookie 的一些敏感信息不要写入 Cookie 中,最好能将 Cookie 信息加密然后使用到的时候再去服务器端解密。

## 公众号

如果大家想要实时关注我更新的文章以及分享的干货的话,可以关注我的公众号。

**《Java面试突击》:** 由本文档衍生的专为面试而生的《Java面试突击》V2.0 PDF 版本[公众号](#公众号)后台回复 **"Java面试突击"** 即可免费领取!

**Java工程师必备学习资源:** 一些Java工程师常用学习资源公众号后台回复关键字 **“1”** 即可免费无套路获取。

![我的公众号](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-6/167598cd2e17b8ec.png)
Loading