docs: update

pull/177/head
Libin YANG 5 months ago
parent bee198f4cc
commit 464d7b5c0f

@ -118,10 +118,6 @@
- [SpringBoot 日志系统](/docs/SpringBoot/SpringBoot-LogSystem.md) - [SpringBoot 日志系统](/docs/SpringBoot/SpringBoot-LogSystem.md)
- [SpringBoot ConditionalOnBean](/docs/SpringBoot/SpringBoot-ConditionalOnBean.md) - [SpringBoot ConditionalOnBean](/docs/SpringBoot/SpringBoot-ConditionalOnBean.md)
### SpringBootBatch
- [SpringBootBatch 源码](/docs/SpringBootBatch/SpringBootBatch源码.md)
### Spring Cloud ### Spring Cloud
- [Spring Cloud Commons 源码](docs/SpringCloud/spring-cloud-commons-source-note.md) - [Spring Cloud Commons 源码](docs/SpringCloud/spring-cloud-commons-source-note.md)

@ -171,13 +171,6 @@ export default defineConfig({
{ text: 'SpringBoot ConditionalOnBean', link: '/SpringBoot/SpringBoot-ConditionalOnBean' }, { text: 'SpringBoot ConditionalOnBean', link: '/SpringBoot/SpringBoot-ConditionalOnBean' },
], ],
}, },
// {
// text: 'SpringBootBatch',
// collapsed: true,
// items: [
// { text: 'SpringBootBatch 源码', link: '/SpringBootBatch/SpringBootBatch源码' },
// ],
// },
{ {
text: 'Spring Cloud', text: 'Spring Cloud',
collapsed: true, collapsed: true,

File diff suppressed because it is too large Load Diff

@ -11,7 +11,7 @@
我们每次添加 `<artifactId>spring-boot-starter-security</artifactId>`,启动的时候会有一条类似的日志: 我们每次添加 `<artifactId>spring-boot-starter-security</artifactId>`,启动的时候会有一条类似的日志:
``` ```txt
Using generated springSecurity password: 1db8eb87-e2ee-4c72-88e7-9b85268c4430 Using generated springSecurity password: 1db8eb87-e2ee-4c72-88e7-9b85268c4430
This generated password is for development use only. Your springSecurity configuration must be updated before running your This generated password is for development use only. Your springSecurity configuration must be updated before running your
@ -20,9 +20,9 @@ application in production.
找到 `UserDetailsServiceAutoConfiguration#InMemoryUserDetailsManager` 类,它是 springboot 自动装配的。 找到 `UserDetailsServiceAutoConfiguration#InMemoryUserDetailsManager` 类,它是 springboot 自动装配的。
下面这些都是 springboot 自动装配类,在 `spring-boot-autoconfigure-2.7.7.jar` > META-INF > spring > org.springframework.boot.autoconfigure.AutoConfiguration.imports 中。这些类就是 Spring Security 的全部了。 下面这些都是 springboot 自动装配类
```imports ```java
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration
org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration
@ -689,14 +689,17 @@ public AuthenticationManagerBuilder authenticationManagerBuilder(ObjectPostProce
} }
``` ```
这里面返回了一个`AuthenticationManagerBuilder`的 bean也就是上面`` 这里面返回了一个`AuthenticationManagerBuilder`的 bean也就是上面`HttpSecurityConfiguration#httpSecurity()`的时候需要的类,这个类也是一个`SecurityBuilder`。
HttpSecurityConfiguration#httpSecurity()`的时候需要的类,这个类也是一个`SecurityBuilder`。
> LazyPasswordEncoder defaultPasswordEncoder = new LazyPasswordEncoder(context); ```java
LazyPasswordEncoder defaultPasswordEncoder = new LazyPasswordEncoder(context);
```
首先创建了一个`LazyPasswordEncoder`,就是`PasswordEncoder`,用来管理密码的 首先创建了一个`LazyPasswordEncoder`,就是`PasswordEncoder`,用来管理密码的
> AuthenticationEventPublisher authenticationEventPublisher = getAuthenticationEventPublisher(context); ```java
AuthenticationEventPublisher authenticationEventPublisher = getAuthenticationEventPublisher(context);
```
这个就是在 `SecurityAutoConfiguration` 中创建的 springSecurity 的发布订阅,用来订阅事件 这个就是在 `SecurityAutoConfiguration` 中创建的 springSecurity 的发布订阅,用来订阅事件

@ -6,7 +6,7 @@
为了方便起见,我们直接在`src/main/resources/resources`目录下创建一个`login.html`(不需要 Controller 跳转): 为了方便起见,我们直接在`src/main/resources/resources`目录下创建一个`login.html`(不需要 Controller 跳转):
``` ```html
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@ -58,7 +58,7 @@ public class BrowserConfig extends WebSecurityConfigurerAdapter {
Spring Security 默认会为我们生成一个用户名为 user密码随机的用户实例当然我们也可以定义自己用户信息的获取逻辑只需要实现 Spring Security 提供的**_UserDetailService_**接口即可,该接口只有一个抽象方法**_loadUserByUsername_**,具体实现如下: Spring Security 默认会为我们生成一个用户名为 user密码随机的用户实例当然我们也可以定义自己用户信息的获取逻辑只需要实现 Spring Security 提供的**_UserDetailService_**接口即可,该接口只有一个抽象方法**_loadUserByUsername_**,具体实现如下:
``` ```java
@Service @Service
public class UserDetailService implements UserDetailsService { public class UserDetailService implements UserDetailsService {
@Autowired @Autowired

Loading…
Cancel
Save