Using Tomcat in Production for Spring Boot apps
As a novice with Spring Boot , I need to know the following as I could not find google results in a straight forward manner.
What application servers do they really use for deploying those Spring Boot applications in real life?
Is Tomcat really used by companies - if so do they achieve it using clustering?
spring spring-boot tomcat microservices
add a comment |
As a novice with Spring Boot , I need to know the following as I could not find google results in a straight forward manner.
What application servers do they really use for deploying those Spring Boot applications in real life?
Is Tomcat really used by companies - if so do they achieve it using clustering?
spring spring-boot tomcat microservices
add a comment |
As a novice with Spring Boot , I need to know the following as I could not find google results in a straight forward manner.
What application servers do they really use for deploying those Spring Boot applications in real life?
Is Tomcat really used by companies - if so do they achieve it using clustering?
spring spring-boot tomcat microservices
As a novice with Spring Boot , I need to know the following as I could not find google results in a straight forward manner.
What application servers do they really use for deploying those Spring Boot applications in real life?
Is Tomcat really used by companies - if so do they achieve it using clustering?
spring spring-boot tomcat microservices
spring spring-boot tomcat microservices
asked Nov 19 '18 at 15:24
Spear A1
9518
9518
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Spring boot has an inbuilt Tomcat server, it's simply run from Java.
The Tomcat is built into the jar, so it's the same in any environment.
Here is a typical spring boot jar, with the tomcat jars shown:
greg@greg-XPS-13-9360:~/work/boot-docker/target$ jar tvf boot-docker-1.0.3.jar | grep tomcat
2293 Mon Jan 30 19:45:14 GMT 2017 BOOT-INF/lib/spring-boot-starter-tomcat-1.5.1.RELEASE.jar
241640 Tue Jan 10 21:03:52 GMT 2017 BOOT-INF/lib/tomcat-embed-websocket-8.5.11.jar
3015953 Tue Jan 10 21:03:50 GMT 2017 BOOT-INF/lib/tomcat-embed-core-8.5.11.jar
239791 Tue Jan 10 21:03:50 GMT 2017 BOOT-INF/lib/tomcat-embed-el-8.5.11.jar
We run our spring boot applications as docker images (complete virtual Unix server) on Redhat Openshift cloud, which is typical.
BTW Tomcat is used commercially and is very reliable.
Pardon my ignorance - I have 2 queries that tag along 1) So the real prod system will be fine with JUST being a *nix server with java installed? 2) So in that case do you just run 100s of instances of your Spring boot projects to handle a service ?
– Spear A1
Nov 19 '18 at 15:38
@Velan yes to point 1, usually they are run in a cloud which will elastically scale, but it would have to be a massive load to require 100s.
– Essex Boy
Nov 19 '18 at 15:44
Thanks for your helpful explanations @EssexBoy
– Spear A1
Nov 19 '18 at 17:34
add a comment |
With Spring Boot application, you can generate an application jar which contains Embedded Tomcat. You can run a web application as a normal Java application.
If you still want to deploy your application with Tomcat Server.
First, you need to package a WAR application instead of a JAR. For this, you need to change pom.xml with the following content:
<profiles>
<profile>
<id>war</id>
<properties>
<packaging.type>war</packaging.type>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>ROOT</finalName>
</build>
</profile>
</profiles>
Let’s modify the final WAR file name in finalName element. (for my case, output is ROOT.war)
Next, to initialize the Servlet context required by Tomcat by implementing the SpringBootServletInitializer interface:
@SpringBootApplication
public class YourApplication extends SpringBootServletInitializer {
}
Then, execute Maven command package with war profile:
mvn clean package -Pwar
Thanks @huytmb.
– Spear A1
Nov 19 '18 at 17:37
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377757%2fusing-tomcat-in-production-for-spring-boot-apps%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Spring boot has an inbuilt Tomcat server, it's simply run from Java.
The Tomcat is built into the jar, so it's the same in any environment.
Here is a typical spring boot jar, with the tomcat jars shown:
greg@greg-XPS-13-9360:~/work/boot-docker/target$ jar tvf boot-docker-1.0.3.jar | grep tomcat
2293 Mon Jan 30 19:45:14 GMT 2017 BOOT-INF/lib/spring-boot-starter-tomcat-1.5.1.RELEASE.jar
241640 Tue Jan 10 21:03:52 GMT 2017 BOOT-INF/lib/tomcat-embed-websocket-8.5.11.jar
3015953 Tue Jan 10 21:03:50 GMT 2017 BOOT-INF/lib/tomcat-embed-core-8.5.11.jar
239791 Tue Jan 10 21:03:50 GMT 2017 BOOT-INF/lib/tomcat-embed-el-8.5.11.jar
We run our spring boot applications as docker images (complete virtual Unix server) on Redhat Openshift cloud, which is typical.
BTW Tomcat is used commercially and is very reliable.
Pardon my ignorance - I have 2 queries that tag along 1) So the real prod system will be fine with JUST being a *nix server with java installed? 2) So in that case do you just run 100s of instances of your Spring boot projects to handle a service ?
– Spear A1
Nov 19 '18 at 15:38
@Velan yes to point 1, usually they are run in a cloud which will elastically scale, but it would have to be a massive load to require 100s.
– Essex Boy
Nov 19 '18 at 15:44
Thanks for your helpful explanations @EssexBoy
– Spear A1
Nov 19 '18 at 17:34
add a comment |
Spring boot has an inbuilt Tomcat server, it's simply run from Java.
The Tomcat is built into the jar, so it's the same in any environment.
Here is a typical spring boot jar, with the tomcat jars shown:
greg@greg-XPS-13-9360:~/work/boot-docker/target$ jar tvf boot-docker-1.0.3.jar | grep tomcat
2293 Mon Jan 30 19:45:14 GMT 2017 BOOT-INF/lib/spring-boot-starter-tomcat-1.5.1.RELEASE.jar
241640 Tue Jan 10 21:03:52 GMT 2017 BOOT-INF/lib/tomcat-embed-websocket-8.5.11.jar
3015953 Tue Jan 10 21:03:50 GMT 2017 BOOT-INF/lib/tomcat-embed-core-8.5.11.jar
239791 Tue Jan 10 21:03:50 GMT 2017 BOOT-INF/lib/tomcat-embed-el-8.5.11.jar
We run our spring boot applications as docker images (complete virtual Unix server) on Redhat Openshift cloud, which is typical.
BTW Tomcat is used commercially and is very reliable.
Pardon my ignorance - I have 2 queries that tag along 1) So the real prod system will be fine with JUST being a *nix server with java installed? 2) So in that case do you just run 100s of instances of your Spring boot projects to handle a service ?
– Spear A1
Nov 19 '18 at 15:38
@Velan yes to point 1, usually they are run in a cloud which will elastically scale, but it would have to be a massive load to require 100s.
– Essex Boy
Nov 19 '18 at 15:44
Thanks for your helpful explanations @EssexBoy
– Spear A1
Nov 19 '18 at 17:34
add a comment |
Spring boot has an inbuilt Tomcat server, it's simply run from Java.
The Tomcat is built into the jar, so it's the same in any environment.
Here is a typical spring boot jar, with the tomcat jars shown:
greg@greg-XPS-13-9360:~/work/boot-docker/target$ jar tvf boot-docker-1.0.3.jar | grep tomcat
2293 Mon Jan 30 19:45:14 GMT 2017 BOOT-INF/lib/spring-boot-starter-tomcat-1.5.1.RELEASE.jar
241640 Tue Jan 10 21:03:52 GMT 2017 BOOT-INF/lib/tomcat-embed-websocket-8.5.11.jar
3015953 Tue Jan 10 21:03:50 GMT 2017 BOOT-INF/lib/tomcat-embed-core-8.5.11.jar
239791 Tue Jan 10 21:03:50 GMT 2017 BOOT-INF/lib/tomcat-embed-el-8.5.11.jar
We run our spring boot applications as docker images (complete virtual Unix server) on Redhat Openshift cloud, which is typical.
BTW Tomcat is used commercially and is very reliable.
Spring boot has an inbuilt Tomcat server, it's simply run from Java.
The Tomcat is built into the jar, so it's the same in any environment.
Here is a typical spring boot jar, with the tomcat jars shown:
greg@greg-XPS-13-9360:~/work/boot-docker/target$ jar tvf boot-docker-1.0.3.jar | grep tomcat
2293 Mon Jan 30 19:45:14 GMT 2017 BOOT-INF/lib/spring-boot-starter-tomcat-1.5.1.RELEASE.jar
241640 Tue Jan 10 21:03:52 GMT 2017 BOOT-INF/lib/tomcat-embed-websocket-8.5.11.jar
3015953 Tue Jan 10 21:03:50 GMT 2017 BOOT-INF/lib/tomcat-embed-core-8.5.11.jar
239791 Tue Jan 10 21:03:50 GMT 2017 BOOT-INF/lib/tomcat-embed-el-8.5.11.jar
We run our spring boot applications as docker images (complete virtual Unix server) on Redhat Openshift cloud, which is typical.
BTW Tomcat is used commercially and is very reliable.
edited Nov 19 '18 at 15:52
answered Nov 19 '18 at 15:33


Essex Boy
4,4281815
4,4281815
Pardon my ignorance - I have 2 queries that tag along 1) So the real prod system will be fine with JUST being a *nix server with java installed? 2) So in that case do you just run 100s of instances of your Spring boot projects to handle a service ?
– Spear A1
Nov 19 '18 at 15:38
@Velan yes to point 1, usually they are run in a cloud which will elastically scale, but it would have to be a massive load to require 100s.
– Essex Boy
Nov 19 '18 at 15:44
Thanks for your helpful explanations @EssexBoy
– Spear A1
Nov 19 '18 at 17:34
add a comment |
Pardon my ignorance - I have 2 queries that tag along 1) So the real prod system will be fine with JUST being a *nix server with java installed? 2) So in that case do you just run 100s of instances of your Spring boot projects to handle a service ?
– Spear A1
Nov 19 '18 at 15:38
@Velan yes to point 1, usually they are run in a cloud which will elastically scale, but it would have to be a massive load to require 100s.
– Essex Boy
Nov 19 '18 at 15:44
Thanks for your helpful explanations @EssexBoy
– Spear A1
Nov 19 '18 at 17:34
Pardon my ignorance - I have 2 queries that tag along 1) So the real prod system will be fine with JUST being a *nix server with java installed? 2) So in that case do you just run 100s of instances of your Spring boot projects to handle a service ?
– Spear A1
Nov 19 '18 at 15:38
Pardon my ignorance - I have 2 queries that tag along 1) So the real prod system will be fine with JUST being a *nix server with java installed? 2) So in that case do you just run 100s of instances of your Spring boot projects to handle a service ?
– Spear A1
Nov 19 '18 at 15:38
@Velan yes to point 1, usually they are run in a cloud which will elastically scale, but it would have to be a massive load to require 100s.
– Essex Boy
Nov 19 '18 at 15:44
@Velan yes to point 1, usually they are run in a cloud which will elastically scale, but it would have to be a massive load to require 100s.
– Essex Boy
Nov 19 '18 at 15:44
Thanks for your helpful explanations @EssexBoy
– Spear A1
Nov 19 '18 at 17:34
Thanks for your helpful explanations @EssexBoy
– Spear A1
Nov 19 '18 at 17:34
add a comment |
With Spring Boot application, you can generate an application jar which contains Embedded Tomcat. You can run a web application as a normal Java application.
If you still want to deploy your application with Tomcat Server.
First, you need to package a WAR application instead of a JAR. For this, you need to change pom.xml with the following content:
<profiles>
<profile>
<id>war</id>
<properties>
<packaging.type>war</packaging.type>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>ROOT</finalName>
</build>
</profile>
</profiles>
Let’s modify the final WAR file name in finalName element. (for my case, output is ROOT.war)
Next, to initialize the Servlet context required by Tomcat by implementing the SpringBootServletInitializer interface:
@SpringBootApplication
public class YourApplication extends SpringBootServletInitializer {
}
Then, execute Maven command package with war profile:
mvn clean package -Pwar
Thanks @huytmb.
– Spear A1
Nov 19 '18 at 17:37
add a comment |
With Spring Boot application, you can generate an application jar which contains Embedded Tomcat. You can run a web application as a normal Java application.
If you still want to deploy your application with Tomcat Server.
First, you need to package a WAR application instead of a JAR. For this, you need to change pom.xml with the following content:
<profiles>
<profile>
<id>war</id>
<properties>
<packaging.type>war</packaging.type>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>ROOT</finalName>
</build>
</profile>
</profiles>
Let’s modify the final WAR file name in finalName element. (for my case, output is ROOT.war)
Next, to initialize the Servlet context required by Tomcat by implementing the SpringBootServletInitializer interface:
@SpringBootApplication
public class YourApplication extends SpringBootServletInitializer {
}
Then, execute Maven command package with war profile:
mvn clean package -Pwar
Thanks @huytmb.
– Spear A1
Nov 19 '18 at 17:37
add a comment |
With Spring Boot application, you can generate an application jar which contains Embedded Tomcat. You can run a web application as a normal Java application.
If you still want to deploy your application with Tomcat Server.
First, you need to package a WAR application instead of a JAR. For this, you need to change pom.xml with the following content:
<profiles>
<profile>
<id>war</id>
<properties>
<packaging.type>war</packaging.type>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>ROOT</finalName>
</build>
</profile>
</profiles>
Let’s modify the final WAR file name in finalName element. (for my case, output is ROOT.war)
Next, to initialize the Servlet context required by Tomcat by implementing the SpringBootServletInitializer interface:
@SpringBootApplication
public class YourApplication extends SpringBootServletInitializer {
}
Then, execute Maven command package with war profile:
mvn clean package -Pwar
With Spring Boot application, you can generate an application jar which contains Embedded Tomcat. You can run a web application as a normal Java application.
If you still want to deploy your application with Tomcat Server.
First, you need to package a WAR application instead of a JAR. For this, you need to change pom.xml with the following content:
<profiles>
<profile>
<id>war</id>
<properties>
<packaging.type>war</packaging.type>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>ROOT</finalName>
</build>
</profile>
</profiles>
Let’s modify the final WAR file name in finalName element. (for my case, output is ROOT.war)
Next, to initialize the Servlet context required by Tomcat by implementing the SpringBootServletInitializer interface:
@SpringBootApplication
public class YourApplication extends SpringBootServletInitializer {
}
Then, execute Maven command package with war profile:
mvn clean package -Pwar
edited Nov 19 '18 at 16:03
answered Nov 19 '18 at 15:46


huytmb
974
974
Thanks @huytmb.
– Spear A1
Nov 19 '18 at 17:37
add a comment |
Thanks @huytmb.
– Spear A1
Nov 19 '18 at 17:37
Thanks @huytmb.
– Spear A1
Nov 19 '18 at 17:37
Thanks @huytmb.
– Spear A1
Nov 19 '18 at 17:37
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377757%2fusing-tomcat-in-production-for-spring-boot-apps%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown