loaded image does not work when build spring boot app as jar

Hi everyone,

I just load an image via
Image image = new Image(“frontend/icon.png”, “Image not found”);

The image is in the src/main/webapp/frontend -folder. When I run my spring boot application local, everything works fine.

When I deploy my spring boot app as a jar on aws in production mode, the image is not found.

Can someone help me, what I miss?

Thanks and kind regards,

Jonas

Hi Jonas,

The image should be in
src\main\resources\META-INF\resources\

In a JAR Maven project there is no webapp folder. Why do you use the webapp folder?

Greetings,
Simon

Hi Simon,

Thank you very much!

I found it here, after another try did not work.

https://vaadin.com/forum/thread/17787475/proper-ways-to-reference-resource-url-for-image-in-v14

Yes, it sounds clear that there is no webapp folder in a jar file.

Thanks, I changed it and now it works :slight_smile:

Greetings, Jonas

Great that it works!

Always start here: http://start.vaadin.com/

So you will get a good example how to structure a Vaadin app and where to put the stuff.