In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to build the commonservice-eureka project of spring cloud". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Create a maven project named particle-common-eureka and inherit particle-commonservice. The specific pom.xml configuration file is as follows:
4.0.0 com.ml.honghu particle-commonservice 0.0.1-SNAPSHOT particle-commonservice-eureka jar particle-commonservice-eureka particle-commonservice project for Spring Boot org.springframework.cloud spring-cloud-starter-eureka-server org. Springframework.boot spring-boot-starter-security org.springframework.boot spring-boot-devtools org.springframework.boot spring-boot-starter-test test Org.springframework.boot spring-boot-maven-plugin 1 repackage 2 build-info true
two。 Refer to the relevant configuration of eureka in the startup class entry, as follows:
Package com.ml.honghu; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @ EnableEurekaServer @ SpringBootApplication public class ServiceApplication {public static void main (String [] args) {SpringApplication.run (ServiceApplication.class, args);}}
3. Configure the application.yml file
# server (eureka default port is: 8761) server: port: 8761 # spring spring: application: name: particle-commonservice-erueka # eureka eureka: client: # whether to register with eureka register-with-eureka: true # whether to obtain registration information from eureka fetch-registry: false availability-zones: honghu: honghuZone service-url: honghuZone: http : / / honghu:123456@localhost:8761/eureka/ defaultZone: http://honghu:123456@localhost:8761/eureka/ instance: prefer-ip-address: true hostname: localhost metadataMap: zone: honghuZone user: ${security.user.name} password: {security.user.password} # specify the environment environment: dev # specify the data center datacenter: Honghu # turn off self-protection mode server: enable-self-preservation: false # set the interval for cleaning up invalid nodes The default is 60000, that is, 60s eviction-interval-timer-in-ms: 60000 # service authentication security: basic: enabled: true user: name: honghu password: 123456 management: security: enabled: false
4. Add the log mechanism and packaging operation mechanism of the project (we will write the packaging deployment mechanism under Linux Centos in detail later)
5. Since then, the entire project has been deployed, and Run As-> Spring Boot App is performed manually. The running result is as follows:
Results of console operation:
Access the console and log in:
Running effect of the console:
This is the end of the content of "how to build spring cloud's commonservice-eureka Project". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.