Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the java version of spring cloud+spring boot+redis multi-tenant social e-commerce platform

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to achieve the java version of spring cloud+spring boot+redis multi-tenant social e-commerce platform, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand.

1. Create a maven project named particle-common-eureka and inherit particle-commonservice. The specific pom.xml configuration file is as follows:

Xml code

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

one

Repackage

two

Build-info

True

two。 Refer to the relevant configuration of eureka in the startup class entry, as follows:

Java code

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 (default port of eureka 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 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:

Thank you for reading this article carefully. I hope the article "how to implement the java version of spring cloud+spring boot+redis multi-tenant social e-commerce platform" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report