Spring全套教学资料
Spring是Java程序员的《葵花宝典》,其中提供的各种大招,能简化我们的开发,大大提升开发效率!目前99%的公司使用了Spring,大家可以去各大招聘网站看一下,Spring算是必备技能,所以一定要掌握。
目录:
部分内容:
Spring源码
- 第一部分 Spring 概述
- 第二部分 核心思想
- 第三部分 手写实现 IoC 和 AOP(自定义Spring框架)
- 第四部分 Spring IOC 高级应用
基础特性
高级特性 - 第五部分 Spring IOC源码深度剖析
设计优雅
设计模式
注意:原则、方法和技巧 - 第六部分 Spring AOP 应用
声明事务控制 - 第七部分 Spring AOP源码深度剖析
必要的笔记、必要的图、通俗易懂的语言化解知识难点
脚手框架:SpringBoot技术
它的目标是简化Spring应用和服务的创建、开发与部署,简化了配置文件,使用嵌入式web服务器,含有诸多开箱即用的微服务功能,可以和spring cloud联合部署。
Spring Boot的核心思想是约定大于配置,应用只需要很少的配置即可,简化了应用开发模式。
- SpringBoot入门
- 配置文件
- 日志
- Web开发
- Docker
- SpringBoot与数据访问
- 启动配置原理
- 自定义starter
微服务架构:Spring Cloud Alibaba
同 Spring Cloud 一样,Spring Cloud Alibaba 也是一套微服务解决方案,包含开发分布式应用微服务的必需组件,方便开发者通过 Spring Cloud 编程模型轻松使用这些组件来开发分布式应用服务。
- 微服务架构介绍
- Spring Cloud Alibaba介绍
- 微服务环境搭建
- 服务治理
- 服务容错
- 服务网关
- 链路追踪
- ZipKin集成及数据持久化
- 消息驱动
- 短信服务
- Nacos Confifig—服务配置
- Seata—分布式事务
- Dubbo—rpc通信
Spring MVC
目录:
部分内容:
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e){}
public void mouseClicked(MouseEvent e){ }
}
//ClientUI.java
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
public class ClientUI extends JFrame {
private JSplitPane bigSplitPane;
private JScrollPane showInfoPane;
private JPanel btnPanel;
private JLabel lblPlayers;
private JTextField txtPlayerBlack, txtPlayerWhite;
private Dimension minimumSize;
private Board board;
public static final String PLAY = “Start Game”;
public static final String EXIT = “Exit”;
public static final String REPLAY = “Replay”;
public static final String NEXTGAME = “Next Game”;
public ClientUI() {
super("Composite Pattern- Wuzi Qi ");
minimumSize = new Dimension(130, 100);
board = new Board();
setUpChoicePanel();
setUpScrollPanes();
}
private void setUpChoicePanel() {
lblPlayers = new JLabel(“Enter players before Playing”);
txtPlayerBlack = new JTextField(“player-black”);
txtPlayerWhite = new JTextField(“player-white”);
ButtonListener btnListener = new ButtonListener();
//Create button objects
JButton playButton = new JButton(PLAY);
JButton nextButton = new JButton(NEXTGAME);
JButton exitButton = new JButton(EXIT);
JButton replayButton = new JButton(REPLAY);
playButton.setMnemonic(KeyEvent.VK_S);
nextButton.setMnemonic(KeyEvent.VK_S);
exitButton.setMnemonic(KeyEvent.VK_X);
replayButton.setMnemonic(KeyEvent.VK_X);
playButton.addActionListener(btnListener);
exitButton.addActionListener(btnListener);
replayButton.addActionListener(btnListener);
nextButton.addActionListener(btnListener);
btnPanel = new JPanel();
btnPanel.setBackground(Color.gray);
GridBagLayout gridbag = new GridBagLayout();
btnPanel.setLayout(gridbag);
GridBagConstraints gbc = new GridBagConstraints();
btnPanel.add(lblPlayers);
btnPanel.add(txtPlayerBlack);
btnPanel.add(txtPlayerWhite);
btnPanel.add(playButton);
btnPanel.add(nextButton);
btnPanel.add(exitButton);
btnPanel.add(replayButton);
gbc.insets.top = 5;
gbc.insets.bottom = 5;
gbc.insets.left = 5;
gbc.insets.right = 5;
gbc.gridx = 0;
gbc.gridy = 1;
gridbag.setConstraints(lblPlayers, gbc);
gbc.gridx = 1;
gbc.gridy = 1;
gridbag.setConstraints(txtPlayerBlack, gbc);
gbc.gridx = 2;
gbc.gridy = 1;
gridbag.setConstraints(txtPlayerWhite, gbc);
gbc.insets.left = 2;
gbc.insets.right = 2;
gbc.insets.top = 15;
gbc.gridx = 0;
gbc.gridy = 5;
gridbag.setConstraints(playButton, gbc);
gbc.gridx = 1;
gbc.gridy = 5;
gridbag.setConstraints(nextButton, gbc);
gbc.gridx = 2;
gbc.gridy = 5;
gridbag.setConstraints(exitButton, gbc);
gbc.gridx = 3;
gbc.gridy = 5;
gridbag.setConstraints(replayButton, gbc);
}
private void setUpScrollPanes() {
showInfoPane = new JScrollPane( board);
showInfoPane.setBackground(Color.orange);
bigSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, showInfoPane, btnPanel);
bigSplitPane.setDividerLocation(450);
getContentPane().add(bigSplitPane);
setSize(new Dimension(450, 600));
setVisible(true);
}
class ButtonListener implements ActionListener {
public void actionPerformed(ActionEvent ae) {
if (ae.getActionCommand().equals(EXIT)) { System.exit(1); }
if (ae.getActionCommand().equals(PLAY)) {
String blackPlayer = txtPlayerBlack.getText();
String whitePlayer = txtPlayerWhite.getText();
if(blackPlayer.length() != 0 && whitePlayer.length() !=0){
board.setPlayers(blackPlayer, whitePlayer);
board.resetGame();
}
}
if (ae.getActionCommand().equals(NEXTGAME)) {
board.removeAll();
String blackPlayer = txtPlayerBlack.getText();
String whitePlayer = txtPlayerWhite.getText();
if(blackPlayer.length() != 0 && whitePlayer.length() !=0)
board.setPlayers(blackPlayer, whitePlayer);
board.resetGame();
}
if (ae.getActionCommand().equals(REPLAY)) {
board.replay();
}
}
}
public static void main(String args[]) {
try { UIManager.setLookAndFeel(“com.sun.java.swing.plaf.windows.WindowsLookAndFeel”);
} catch (Exception evt) {}
ClientUI frame = new ClientUI();
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) { System.exit(0); }} );
frame.setSize(450, 600);
frame.setVisible(true);
}
}
//Composite.java
import java.util.ArrayList;
import java.util.Iterator;
// Chess board for Game of Go
class Composite extends ChessComponent{
private int[] position = null;
private ArrayList arrGoStone = null;
private ChessComponent currentPiece = null;
public Composite(){
arrGoStone = new ArrayList();
}
public void attach(ChessComponent piece){
if(piece != null)
arrGoStone.add(piece);
}
public void detach(ChessComponent piece){
if(piece != null)
arrGoStone.remove(piece);
}
public void removeAllElements(){
arrGoStone.clear();
}
public Iterator elements(){
return arrGoStone.iterator();
}
public ChessComponent getElement(int k){
return arrGoStone.get(k);
}
public void setPosition(int x, int y){ }
public int[ ] getPosition(){
return position;
}
public String showInfo(){
return “This is composite.”;
}
public int getSize(){
return arrGoStone.size();
}
public int getColor(){
return 0;
}
}
//GameOperations.java
// This class encapsulates all the operations
// needed by the game logic. All the methods
// here are to called by the class Board
public class GameOperations{
private int LEN = Board.LENGTH;
private Board b = null;
public GameOperations(Board b){
this.b = b;
}
// Get a right slant line from a 2D integer array, 0 <= k < 29
public int[] getALeftSlantLine(int[][] intArr, int k){
int n=0;
int[] temp = new int[LEN];
for(int i=0; i<LEN; i++) {
for(int j=0; j<LEN; j++) {
if(i + j == k){
temp[n] = intArr[i][j];
} // if
} // for j ended, only assign term n of temp
n++;
} // for i ended, temp is filled with a left matrix diagonal line
return temp;
}
// Get a right slant line from a 2D integer array, k=-14 to 14 inclusive
public int[] getARightSlantLine(int[][] intArr, int k){
int n=0;
int[] temp = new int[LEN];
for(int i=0; i<LEN; i++) {
for(int j=0; j<LEN; j++) {
if(i == j+ k){
temp[n] = intArr[i][j];
} // if
} // for j ended, only assign term n of temp
n++;
} // for i ended, temp is filled with a right matrix diagonal line
return temp;
}
// Check a line to decide if a player wins or not
public void checkAline(int[] a){
int len = a.length;
for(int m=3; m< len-2; m++){
if( (a[m-2]==1)&&(a[m-1]==1)&&(a[m]==1)&&(a[m+1]==1)&&(a[m+2]==1) ){
b.setGameOver(true);
}
}
}
// Check all horizental and vertical lines of the matrix to
// see if the black player or white player wins or not
public void checkMatixLines(int[][] intArr){
for(int n=0; n<LEN; n++){
int[] b = new int[LEN];
for(int i=0; i<LEN; i++)
b[i] = intArr[i][n];
checkAline(b);
}
for(int m=0; m<LEN; m++){
int[] c = new int[LEN];
for(int j=0; j<LEN; j++)
c[j] = intArr[m][j];
checkAline©;
}
}
// Check all left slant lines of the matrix to see if
// the black player or white player wins or not
public void checkLeftSlantDiagonal(int[][] board){
for (int k=0; k<2*LEN-1; k++) {
int[] temp = new int[LEN];
temp=getALeftSlantLine(board, k);
checkAline(temp);
}
}
// Check all right slant lines of the matrix to see if
// the black player or white player wins or not
public void checkRightSlantDiagonal(int[][] board){
for (int k=-(LEN-1); k<LEN; k++) {
int[] temp = new int[LEN];
temp=getARightSlantLine(board, k);
checkAline(temp);
}
}
}
//GChessPiece.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.JOptionPane;
import java.awt.geom.Ellipse2D;
// Represents a Piece of the Wuzi Qi Game
class GChessPiece extends Canvas {
Color color = null;
Ellipse2D circle = new Ellipse2D.Double(0.0d, 0.0d, 26.0d, 26.0d);
GChessPiece(Color color) {
this.color=color;
setSize(26, 26);
}
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
g2.setColor(color);
g2.fill(circle);
}
}
//WhitePiece.java
import java.awt.*;
// White Stone of Game of Go
// Used to encapsulate the data needed for a
// white chess piece: position and color
class WhitePiece extends ChessComponent {
int[] position = new int[2];
private static final int WHITE = -1;
WhitePiece() {
position = new int[2];
}
public int[ ] getPosition(){
return position;
}
public void setPosition(int x, int y){
position[0] = x;
position[1] = y;
}
public String showInfo(){
return “This is white piece.”;
最后
在面试前我整理归纳了一些面试学习资料,文中结合我的朋友同学面试美团滴滴这类大厂的资料及案例
由于篇幅限制,文档的详解资料太全面,细节内容太多,所以只把部分知识点截图出来粗略的介绍,每个小节点里面都有更细化的内容!
大家看完有什么不懂的可以在下方留言讨论也可以关注。
觉得文章对你有帮助的话记得关注我点个赞支持一下!
te static final int WHITE = -1;
WhitePiece() {
position = new int[2];
}
public int[ ] getPosition(){
return position;
}
public void setPosition(int x, int y){
position[0] = x;
position[1] = y;
}
public String showInfo(){
return “This is white piece.”;
最后
在面试前我整理归纳了一些面试学习资料,文中结合我的朋友同学面试美团滴滴这类大厂的资料及案例
[外链图片转存中…(img-yUy5eBpX-1715333312768)]
[外链图片转存中…(img-GWIScZM4-1715333312768)]
由于篇幅限制,文档的详解资料太全面,细节内容太多,所以只把部分知识点截图出来粗略的介绍,每个小节点里面都有更细化的内容!
大家看完有什么不懂的可以在下方留言讨论也可以关注。
觉得文章对你有帮助的话记得关注我点个赞支持一下!