In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
The content of this article mainly focuses on how to upgrade JeecgBoot monomer microservices, the content of the article is clear and easy to understand, organized, very suitable for beginners to learn, worth reading. Interested friends can read along with Xiaobian. I hope everyone gets something out of this article!
JeecgBoot has been asked the most since the open source is the microservice version when it comes out? Microservices are a trend, and with interest in the mid-tier concept in particular, every company has an urgent need for microservices. In response to your needs, we launched the SpringCloud Alibaba system adopted by Jeecg-Cloud version!! However, maintaining two sets of code at the same time is too expensive for our team. In order to reduce maintenance costs and let users have intelligent choices, we launched a new version of JeecgBoot 2.3. We specially made a free switching mechanism between monomer and microservice. A set of code can easily switch between monomer and microservice.
The current new JeecgBoot 2.3 platform provides system, demo and other modules by default, which can quickly start each module separately as a microservice application and switch to cloud. This project adopts SpringCloud Alibaba technology stack as follows:
Service registration: nacos
Configuration Center: nacos-config
Reason gateway: gateway
Service call: openfeign
Fuse and degradation: sentinel
Service Monitoring: Spring Boot Admin
Video Tutorial: >> Single Upgrade Microservice Video Tutorial
The following is a rapid upgrade of the single micro-service solution: I. Upgrade the system module to independent services
1. Remove dependencies from other modules in the pom file of the system project, leaving only local-api
2. The system project starts as a microservice and needs to add microservice dependencies.
com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery com.alibaba.cloud spring-cloud-starter-alibaba-nacos-config com.alibaba.cloud spring-cloud-starter-alibaba-sentinel
3. Under the resource folder, create bootstrap.yml, which reads as follows:
spring: profiles: active: dev application: name: jeecg-system cloud: nacos: discovery: server-addr: 127.0.0.1:8848feign: sentinel: enabled: true
4. Modify dev configuration file, delete two configurations in screenshot
5. Start class annotation: @EnableDiscoveryClient
II. Upgrade other modules to independent services (such as demo modules)
Take demo for example:
1. Change pom, change local-api to cloud-api
org.jeecgframework.boot jeecg-system-cloud-api
2. Add the configuration file bootstrap.yml(if not available), which reads as follows:
spring: profiles: active: dev application: name: jeecg-demo cloud: nacos: discovery: server-addr: 127.0.0.1:8848feign: sentinel: enabled: true
3. Add a new configuration file application-dev.yml(if there is none). The content can be copied directly from the file with the same name under system. You need to modify the port number.
4. Create a new startup class under the org.jeecg package (if none exists)
package org.jeecg;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.EnableAutoConfiguration;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.cloud.client.discovery.EnableDiscoveryClient;import org.springframework.cloud.openfeign.EnableFeignClients;import java.net.UnknownHostException;@SpringBootApplication@EnableDiscoveryClient@EnableFeignClientspublic class JeecgDemoApplication { public static void main(String[] args) throws UnknownHostException { SpringApplication.run(JeecgDemoApplication.class, args); }}
After completing the above steps, you can start nacos and run the startup class test microservice for each module.
Third, start Nacos microservice integration Nacos service registration found docke installation nacos document: https://nacos.io/zh-cn/docs/quick-start-docker.html
1. Start nacos, visit localhost:8848/nacos account password is nacos, view service list
2. Start system, demo, and view service list
4. Start the gateway
Startup class: org.jeecg.jeecgGatewayApplication
View online interface documentation: http://127.0.0.1:9999/doc.html
V. Start the front end
The file public/index.html was found in the front-end project, and the background service was modified to gateway address. The modified address is: window._ CONFIG ['domianURL '] = 'http://127.0.0.1:9999, where port number 9999 is consistent with gateway port
Frequently Asked Questions 1. Gateway startup error, gateway project needs to be compiled manually
2. javax.mail.AuthenticationFailedException: 535 Error: authentication failed
Note: Some configuration needs to be modified for front-end interaction. 1. There is an attribute `context-path: /jeecg-boot` in each service yml configuration. After service, it needs to be modified to `/`, or the configuration can be deleted directly. 2. The file `public/index.html` is found in the front-end project. The modification address is ` window._ CONFIG ['domianURL '] = 'http://127.0.0.1:9999`, where port number`9999`is consistent with gateway port 3. Cross-domain settings, this setting can be ignored, the document is reserved for records #Cross-domain issues comment out the cross-domain settings of these two classes org/jeecg/config/shiro/filters/JwtFilter.java:65org/jeecg/config/WebMvcConfiguration.java:49 Thank you for reading, I believe you have a certain understanding of "how to upgrade JeecgBoot monomer microservices" This problem, go to practice it, if you want to know more related knowledge points, you can pay attention to the website! The editor will continue to bring better articles to everyone!
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: 281
*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.