In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you the relevant knowledge points about how to set the springboot startup port on CVM. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
CVM: spring boot is a good thing, it can be launched directly in the main method without a container, and no configuration file is needed, so it is convenient to build the environment quickly. However, when we want to start two springboot projects at the same time, there will be a problem. It is possible that port 8080 is occupied by the first application and the second application cannot be started, so we need to modify the startup port of one of the projects.
This can be achieved by implementing the EmbeddedServletContainerCustomizer interface:
Public class Application extends SpringBootServletInitializer implements EmbeddedServletContainerCustomizer {@ Override protected SpringApplicationBuilder configure (SpringApplicationBuilder builder) {return builder.sources (Application.class);} public static void main (String [] args) {SpringApplication.run (Application.class, args);} @ Override public void customize (ConfigurableEmbeddedServletContainer container) {container.setPort (8081);}}
PS: let's take a look at spring boot creation application port conflict 8080
If the 8080 port number on your computer is occupied by another program (such as jenkins), running lightsword will report the following error: java.net.BindException: Address already in use.Failed to start component [Connector [HTTP/1.1-8080]].
Solution: create a new file under the src- > main- > resources directory, named application.properties (this is the SpringBoot unified configuration file) and add the following line: (take a port number available on your computer, such as 9527 below, those who have seen Sing Yeh movies will know it) server.port = 9527
Just run it again.
These are all the contents of the article "how to set the springboot startup port on a CVM". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.