【问题标题】:react-and-spring-data-rest tutorial and Javascript editingreact-and-spring-data-rest 教程和 Javascript 编辑
【发布时间】:2017-12-29 17:55:18
【问题描述】:

我正在玩这个教程: https://spring.io/guides/tutorials/react-and-spring-data-rest/

这很有趣,进入spring boot,data,rest和react,但我一直在玩这个问题:编辑Javascript后,必须重新启动spring应用程序并清空浏览器的缓存。

作者建议:“想看到你的 JavaScript 自动变化吗?运行 npm run-script watch 让 webpack 进入监视模式。它会在你编辑源代码时重新生成 bundle.js。”但是如果js源有效地自动重建,spring app中“运行”的js并没有更新,app也没有重启……

看来解决的办法应该是把boot应用项目改成war项目,这样在src/main/webapp下修改的资源会在eclipse内嵌的tomcat中自动更新...

有人已经解决了这个问题?

【问题讨论】:

    标签: spring eclipse reactjs spring-boot spring-data-rest


    【解决方案1】:

    我在这里找到了解决方案,https://stackoverflow.com/users/999466/eigilRefreshing static content with Spring MVC and Boot

    在 pom.xml 中添加配置后,使用 mvnw spring-boot:run 启动应用程序,就像在线程中一样。

    我必须启动命令npm run-script watch 正如项目根目录中的教程中所建议的那样。

    编辑js文件的时候,刷新后直接在浏览器上看到修改,耶!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-26
      • 2014-03-07
      • 2015-10-21
      • 1970-01-01
      相关资源
      最近更新 更多