我想为自己的个人爱好做个网站,所以用了配置较少的springboot
但是我在更改了css文件或者改了页面之后,如果不重启项目的话,就不能够更新这些文件,
我百度了一些答案,但是好像不行.
所以我想来确认一下,springboot能够像tomcat一样不用重启,就更新更改的静态文件吗?

解决方案 »

  1.   

    application.properties属性文件增加spring.thymeleaf.cache=false
      

  2.   


    我这个对文件放的目录有要求吗?
    我用的html文件做页面
    spring:
      mvc:
        static-path-pattern: /** # 静态资源访问配置
        view:
          prefix: /Web/
          suffix: .html
    配置我是这么配的
    页面我按照说的修改了
      thymeleaf:
        cache: false
    重启项目之后没有更新静态文件,请问是我还有哪里做错了吗?
      

  3.   

    项目更新静态文件,你怎么更新服务器呢?或者是一个独立的静态文件war工程,单独部署?这个问题不是开发部门独立解决的,还和运维支撑相关最好的办法是使用负载均衡/反向代理,将静态资源发送到apache/nginx上去,效率高
      

  4.   

    idea 有个jrebel plugins 可以用实现 
      

  5.   

    jrebel 插件帮到你,直接ctrl+F9  就可以了.
      

  6.   

    在pom加入这个
    <build>  
        <finalName>my-spring-boot</finalName> <!-- 指定package生成的文件名为my-spring-boot.jar -->  
          
        <plugins>  
            <plugin>  
                <groupId>org.springframework.boot</groupId>  
                <artifactId>spring-boot-maven-plugin</artifactId>  
                <dependencies>    <!-- 修改代码后自动生效,Reload Java classes without restarting the container -->  
                    <dependency>  
                        <groupId>org.springframework</groupId>  
                        <artifactId>springloaded</artifactId>  
                        <version>1.2.6.RELEASE</version>  
                    </dependency>  
                </dependencies>  
            </plugin>  
        </plugins>  
    </build>  
      

  7.   

     resources:
            static-locations: classpath:/META-INF/resources/,classpath:/resources/,
                                classpath:/static/,classpath:/public/,file:/qrcode/,
                                file:/guidepicture/
    可以试试  我这是东泰加载静态图片 css应该也是一样,只不过你引用外部的