【发布时间】:2014-06-17 07:56:05
【问题描述】:
我已经阅读了Hot swapping in Spring Boot,但没有找到对我的案子有帮助的东西。
我在使用 thymeleaf 的嵌入式码头服务器上有一个 spring-boot 应用程序。我的应用程序将提供 html、css、js(AngularJS) 和 REST 服务。
文件夹结构是这样的:
/java
----
/resources
/static
/js
/css
/templates (html)
pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
但是当我更改 css/html/js 时,它们并没有热部署。我每次都必须重新启动服务器。 +bonus = 当页面加载时它会锁定资源(js),甚至 Ant 脚本也无法替换它们。
我可以在任何地方设置 scanIntervalSeconds 吗?
--编辑--
Main.java
@Configuration
@ComponentScan
@EnableJpaRepositories
@EnableAutoConfiguration
@Import({RepositoryRestMvcConfiguration.class, PersistenceConfig.class, ThymeleafConfig.class})
public class Main {
public static void main(String[] args) throws Exception {
SpringApplication.run(Main.class, args);
}
}
我已经通过在 IDEA 中右键单击类和调试来运行它。
【问题讨论】:
标签: spring maven deployment jetty spring-boot