主要配置如下,出现的题目也都是版本原因。
1、jakarta.servlet-api升级之后,须要把全部的controller或别的类相干的HttpServletResponse、HttpServletRequest,都用jakarta.servlet.http.HttpServletResponse;这个包下面的。
2、yml配置中要有这些东西。
- spring:
- main:
- allow-circular-references: true
- allow-bean-definition-overriding: true
复制代码 3、SecurityFilterChain相干
(1)用这个requestMatchers,原来是antmatcher
(2)/**/*.css要改成/*/*.css,/druid/**改成/druid/*,总之不能有两个**
- requests.requestMatchers("/login", "/register", "/captchaImage").permitAll()
- // 静态资源,可匿名访问
- .requestMatchers(HttpMethod.GET, "/", "/*.html", "/*/*.html", "/*/*.css", "/*/*.js", "/profile/*").permitAll()
- .requestMatchers("/swagger-ui.html", "/swagger-resources/*", "/webjars/*", "/*/api-docs", "/druid/*").permitAll()
- // 除上面外的所有请求全部需要鉴权认证
- .anyRequest().authenticated();
复制代码 4、maven-compiler-plugin要加上这个
- <compilerArgs>
- <arg>-parameters</arg>
- </compilerArgs>
复制代码 5、下面是版本的主要记录
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-framework-bom</artifactId>
- <version>6.1.0</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-bom</artifactId>
- <version>6.0.0</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>3.3.5</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-webmvc</artifactId>
- <version>6.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context-support</artifactId>
- <version>6.1.0</version>
- </dependency>
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>druid-spring-boot-3-starter</artifactId>
- <version>1.2.24</version>
- </dependency>
- <dependency>
- <groupId>org.mybatis.spring.boot</groupId>
- <artifactId>mybatis-spring-boot-starter</artifactId>
- <version>3.0.4</version>
- </dependency>
- <dependency>
- <groupId>jakarta.servlet</groupId>
- <artifactId>jakarta.servlet-api</artifactId>
- <version>6.0.0</version>
- <scope>provided</scope>
- </dependency>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.1</version>
- <configuration>
- <executable>C:\Users\zyh\.jdks\corretto-17.0.14\bin\javac</executable>
- <source>${java.version}</source>
- <target>${java.version}</target>
- <encoding>${project.build.sourceEncoding}</encoding>
- <compilerArgs>
- <arg>-parameters</arg>
- </compilerArgs>
- </configuration>
- </plugin>
- </plugins>
- </build>
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |