user8371723
user8371723

Reputation:

Spring Boot with Angular 2 - place for assets(images)

I have a problem with mapping resources. I have multi-module project where first module if angular 2 which is server by Spring boot in second module. Everything is configured but the problem is connected with path to resources. enter image description here

On the left is compiled Spring module with added build Angular 2 app. In Angular module i have other localization for assets

enter image description here


but when angular build project, flatten the whole project and compiled strucutre is following enter image description here

Upvotes: 1

Views: 1039

Answers (1)

Julz
Julz

Reputation: 103

Simply use <img src="../assets/yourimage.png" width="30" height="30" alt=""> as relative path.

And be aware of that image names must not be "yourimage_256.png". Spring does not like such kind of names and won't deliver it.

If you use spring boot security you also need to add

.antMatchers("/assets/**").permitAll()

in your WebSecurityConfig

Upvotes: 1

Related Questions