After adding the spring security dependency, http reported 403

all tests before spring boot 2.0 can be added through
pom

    <!--spring security-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <!--spring security test-->
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-test</artifactId>
        <scope>test</scope>
    </dependency>
After

, all 403 is reported. Is there any default configuration for spring security?
added a simple

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeRequests()
                .antMatchers("/").permitAll()
                .anyRequest().authenticated();
    }
}

doesn"t change anything. It"s no use adding @ WithMockUser to the test class, and adding @ Import (WebSecurityConfig.class) to the test class.


reason found, omitted

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-config</artifactId>
    <version>5.0.7.RELEASE</version>
</dependency>
Menu