feat: 实现API文档支持与系统优化
refactor(ArticleRepository): 修正@Param注解导入错误并优化查询方法 fix(ArticleService): 解决事务回滚问题并优化日志配置 feat(SecurityConfig): 添加Spring Security配置禁用默认认证 docs: 添加详细API文档README_API.md feat(HelpController): 实现Markdown文档渲染API style: 清理无用注释和导入 build: 更新pom.xml依赖和插件配置 chore: 优化application.properties配置
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.qf.myafterprojecy.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
|
||||
/**
|
||||
* Spring Security配置类
|
||||
* 用于关闭默认的登录验证功能
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfig {
|
||||
|
||||
/**
|
||||
* 配置安全过滤器链,允许所有请求通过
|
||||
* @param http HttpSecurity对象,用于配置HTTP安全策略
|
||||
* @return 配置好的SecurityFilterChain对象
|
||||
* @throws Exception 配置过程中可能出现的异常
|
||||
*/
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
http
|
||||
// 禁用CSRF保护(对于API服务通常不需要)
|
||||
.csrf().disable()
|
||||
// 允许所有请求通过,不需要认证
|
||||
.authorizeRequests()
|
||||
.anyRequest().permitAll()
|
||||
.and()
|
||||
// 禁用表单登录
|
||||
.formLogin().disable()
|
||||
// 禁用HTTP基本认证
|
||||
.httpBasic().disable()
|
||||
// 禁用会话管理(对于无状态API服务)
|
||||
.sessionManagement().disable();
|
||||
|
||||
return http.build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user