В файле html
есть изображение:
<div class="login-branding">
<a href="index.html"><img src="../static/images/logo.png" alt="Clevex" title="Clevex"></a>
</div>
По адресу http://localhost:8090/login, Я смотрю на консоль и вижу:
ПОЛУЧИТЬ http://localhost:8090/static/images/logo.png 404
Но когда приложение работает, если я перейду к
http://localhost:8090/images/logo.png
этот URL, я могу увидеть изображениебез каких-либо ошибок или предупреждений на консоли браузера chrome
.
Это моя конфигурация безопасности:
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private CustomAuthenticationProvider customAuthenticationProvider;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.cors().and().csrf().disable();
String[] resources = new String[]{
"/",
"/home",
"/pictureCheckCode",
"/include/**",
"/css/**",
"/icons/**",
"/images/**",
"/js/**",
"/resources/**",
"/layer/**",
"/static/**",
"/js/**",
"/img/**",
"/webjars/**"
};
http
.authorizeRequests()
.antMatchers(resources).permitAll()
Я также добавил @EnableAutoConfiguration
, но он ничего не сделал.И также выдал ошибку.
Я не хочу использовать addResourceHandlers
, потому что это весенняя загрузка и она должна выполнить автоконфигурирование.
Каталоги выглядят так:
src
-main
-resources
--static
---images
----logo.png
Вот как начинается приложение:
@SpringBootApplication
public class InternalApplication {
public static void main(String[] args) {
SpringApplication.run(InternalApplication.class, args);
}
}
Любой совет будет оценен.