Spring Boot Aplication的文件位置,默认配置

时间:2016-03-29 19:56:03

标签: java spring-mvc spring-boot

我的Spring Boot App基于TomcatEmbeddedServletContainer

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {

        SpringApplication.run(DemoApplication.class, args);
    }
}

MVC控制器:

@Controller
@EnableWebMvc
public class JspController {

    @RequestMapping("/home")
    public String home(ModelAndView modelAndView) {

        return "home";
    }
}

问题是我运行应用程序时临时文件的位置?我遇到的问题是,在重新运行应用程序后,我的更改并不总是应用...请帮助弄清楚如何在应用程序运行时获取最新的代码版本。

1 个答案:

答案 0 :(得分:0)

通过从Spring Boot Actuator列表发送refresh请求解决了这个问题。

POST /refresh HTTP/1.1
Host: localhost:8080
Cache-Control: no-cache

它重新加载Spring Boot Application的所有静态非静态组件。 要查看所有可用的执行器请求,请导航至http://localhost:8080/actuator

要在您的应用程序上使用执行器,您只需添加spring-boot-starter-actuator maven依赖项:

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>