Skip to content

Commit

Permalink
deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
staven630 committed Jun 21, 2021
1 parent e923372 commit bde17d9
Show file tree
Hide file tree
Showing 33 changed files with 61 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/.vuepress/themeConfig/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
sidebar,
lastUpdated: "Last Updated",
sidebarDepth: 2,
repo: "",
repo: "https://github.com/staven630/blog",
editLinks: false,
footer: {
createYear: 2021,
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion md/Java框架/Spring/12_Spring JDK动态代理.md

This file was deleted.

1 change: 0 additions & 1 deletion md/Java框架/Spring/13_Spring自动装配Bean.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## 依赖注入方式

  Spring 中有两种常见的依赖注入方式:属性注入和构造器注入。

## 构造函数注入
### 构造函数注入

  在 Bean 的配置中,使用 constructor-arg 的子元素配置依赖的对象,对应的 Bean 类需具备对应参数的构造函数。容器反射调用带参数的构造函数进行依赖对象的初始化。

Expand Down Expand Up @@ -52,7 +54,7 @@ public class UserService {

  constructor-arg 配置子元素对应到构造函数的参数,在 ref 子元素的 bean 属性中设置依赖 bean 的 id。

## 设置值注入
### 设置值注入

  设置值注入使用的是属性的 setter 方法来注入依赖对象。

Expand Down Expand Up @@ -92,6 +94,6 @@ public class UserService {

  property 子元素注入依赖对象,name 对应 bean 类中的属性名,ref 设置为依赖 bean 的 id。

## 总结
### 总结

  Spring 官方推荐使用构造器注入方式。实际项目中,推荐使用构造器注入方式注入强制依赖项,使用设置值方式注入可选依赖项。
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
56 changes: 55 additions & 1 deletion scripts/rename.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,58 @@ const path = require('path')
const fs = require('fs-extra')


const resolve = dir => path.resolve(__dirname, dir);
const resolve = dir => path.resolve(__dirname, dir);



function getFiles(rootPath, limit) {
return fs.readdirSync(rootPath)
.filter(file => (file.endsWith('.md') && /^\d+_/.test(file) && +file.split('_')[0] >= limit))
.sort((a, b) => {
const a1 = +a.split('_')[0];
const b1 = +b.split('_')[0];
if (a1 < b1) return -1;
if (a1 > b1) return 1;
return 0;
});
};



function add(dirPath, limit) {
const rootPath = resolve(dirPath);
const files = getFiles(rootPath, limit);
for (const file of files) {
const arr = /(^\d+)_(.*)/.exec(file);
const entryPath = path.resolve(rootPath, file);
const outputName = `${ + arr[1] + 1}_${arr[2]}`;
const outputPath = path.resolve(rootPath, outputName);
fs.renameSync(entryPath, outputPath);
}
}

function multiple(dirPath, limit) {
const rootPath = resolve(dirPath);
const files = getFiles(rootPath, limit);
for (const file of files) {
const arr = /(^\d+)_(.*)/.exec(file);
const entryPath = path.resolve(rootPath, file);
const outputName = `${ + arr[1] - 1}_${arr[2]}`;
const outputPath = path.resolve(rootPath, outputName);
fs.renameSync(entryPath, outputPath);
}
}

function remove(dirPath, limit) {
const rootPath = resolve(dirPath);
const files = getFiles(rootPath, limit);
for (const file of files) {
const arr = /(^\d+)_(.*)/.exec(file);
const entryPath = path.resolve(rootPath, file);
const outputName = `${arr[2]}`;
const outputPath = path.resolve(rootPath, outputName);
fs.renameSync(entryPath, outputPath);
}
}

remove('../md/Java框架/Spring', 13);

0 comments on commit bde17d9

Please sign in to comment.