使用Spring启动对Intellij中的资产进行Livereload [英] Livereload for assets in Intellij using Spring boot

查看:478
本文介绍了使用Spring启动对Intellij中的资产进行Livereload的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在没有Spring启动技术的情况下使用Spring时,我可以使用Tomcat Maven插件启动应用程序并更新我的html,css和js,而无需重新启动服务器以使更改在浏览器中生效。

When using Spring without the Spring boot technology, I can start the application with the Tomcat Maven plugin and update my html, css and js without having to restart the server for the changes to take effect in the browser.

现在,使用Spring启动时,每次我在静态中更改内容时,我都必须在IntelliJ中执行生成任务资产,否则我只是不会看到浏览器的变化。我的Spring Boot应用程序也使用devtools依赖项,我在浏览时将浏览器连接到实时重新加载套接字。

Now, when doing this with Spring boot, I will have to do a Make task in IntelliJ everytime I change something in my static assets, otherwise I just wont see the changes in browser. My Spring Boot application is also using the devtools dependency, and I have the browser connected to the live reload socket when looking.

此配置仍未显示我所做的更改在我的静态文件中。我需要做些什么才能使其工作?

This configuration still does not show the changes I make in my static files. What do I need to do to get this working?

推荐答案

似乎问题出在我的静态资产的位置上。我必须将它们放入 main 包下的 webapp 文件夹中。我之前正在关注Spring.io的指南,建议将静态资产放入 resources 包中。

It seems that the problem was in the placement of my static assets. I had to put them into a webapp folder under the main package. I was following a guide from Spring.io before that advised to put the static assets into resources package instead.

现在我停止使用资源包,一切正常,因为我想要它。

Now that I stopped using the resources package, everything works as i want it to.

这篇关于使用Spring启动对Intellij中的资产进行Livereload的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆