@RestController
@EnableAutoConfiguration
public class DemoApplication {
@RequestMapping("/")
String home() {
return "Hello Spring Boot!";
}
public static void main(String[] args) throws Exception {
SpringApplication.run(DemoApplication.class, args);
}
}
As i understand if we change in the port number it will work . My question how to deploy in the server for each changes
With Spring boot devtools you don't need to kill and restart your application on every change. DevTools can easily restart your application for you on every change. All you need do is add this to your depenendencies
maven
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
</dependencies>
or if you use gradle
dependencies {
compile("org.springframework.boot:spring-boot-devtools")
}
Just adding that dependencies introduces a lot of cool features to your development work flow including automatic restart and livereload. For more on that visit this official spring blog https://spring.io/blog/2015/06/17/devtools-in-spring-boot-1-3
There are several types of development options available.
For development on localhost EAR (Exploded ARchive) type of project is usually used (because you can easily make hot deploy on the server). But for production WAR (Web ARchive) is used (basically it's the same EAR archive, but compressed using ZIP algorithm).
If you want to deploy your project to remote Tomcat server then make your project as WAR archive and upload it to Tomcat's web apps directory. Then you might need to restart Tomcat. But it's a manual way of deploying.
The better option is to use automated build tools (like Maven) which can compile your project, run unit tests, deploy on the web server (local or remote) etc.
and if you have multiple servers then check that any server was running or not. check in server console that no one server is running. if running then stops that then again run your project on the server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With