![](/img/trans.png)
[英]Showing an image on broswer using @ResponseBody in spring boot
[英]Showing uploaded image with Spring boot
在我看來,您可能將圖像存儲在 webapps 中。 如果是這樣的話:
Do not use the src/main/webapp directory if your application will be packaged as a jar. Although this directory is a common standard, it will only work with war packaging and it will be silently ignored by most build tools if you generate a jar.
我假設當你把它放在你的服務器上時,它是一個戰爭文件,所以上面的無關緊要。
最后我可以解決這個錯誤,這似乎是由於 IntellIj 和我沒有使用的 Maven 依賴項:
我這樣做了: Intell IJ
1)Help->Find Action...並輸入“Registry”,在對話框中搜索“automake”並啟用條目“compiler.automake.allow.when.app.running”,關閉對話框
2)在設置->構建、執行、部署->編譯器“自動生成項目”中啟用后台編譯
3)打開Spring Boot運行配置,如果一切配置正確,你應該得到警告信息
4) 運行您的應用程序,即時更改您的類和靜態內容
我還添加了這個 maven 依賴項
org.springframework.boot spring-boot-devtools
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.