Отключить весеннюю защиту при загрузке весной 2.0.2 - PullRequest
0 голосов
/ 24 мая 2018

Я пытаюсь отключить весеннюю защиту в весенней загрузке 2.0.2, добавив свойство security.ignore=/**, но оно не работает со мной.

Мое application.properties:

spring.datasource.url = jdbc:mysql://localhost:3306/smile
spring.datasource.username = root
spring.datasource.password =
spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto = update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

# suppress inspection "SpringBootApplicationProperties"
security.ignored=/**

Результат:

enter image description here

Ответы [ 3 ]

0 голосов
/ 07 июня 2018

Добавить этот класс

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
public class SecurityConfig  extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable().authorizeRequests().anyRequest().permitAll();
    }
}
0 голосов
/ 07 декабря 2018

Для меня это сделал трюк (аналогично ответу @ wilmer-villca):

@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
0 голосов
/ 07 июня 2018

Добавьте этот Java-аннотации в ваше основное приложение весенней загрузки.

@EnableAutoConfiguration(exclude = { 
    SecurityAutoConfiguration.class 
})
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...