從0到1搭建微服務框架

目錄

1.技術棧:

2.模塊介紹:

3.關鍵代碼講解

3.1基礎公共模塊(common)依賴:

3.3授權模塊(auth)依賴:

3.4授權模塊核心配置類(AuthrizatonConfig):

3.4? SecurityConfig.java

?3.5 bootstrap的核心配置文件(其他服務配置類似這個):

3.6nacos上面的配置文件如auth-dev.yaml

3.7 consumer-dev.yaml

3.8 gateway-dev.yaml:

3.9mq-dev.yaml:

4.授權認證模塊演示:

4.1獲取到授權碼:

4.2 通過postman請求獲取access_token

4.2測試通過access_token訪問資源:

4.3 無token攜帶的時候,訪問服務資源

4.4 在指定模塊添加配置類(ResourceServerConfig):

5.nacos相關配置,以及服務注冊情況

5.1nacos配置顯示:

5.2 nacos上服務顯示:


1.技術棧:

SpringCloud? 微服務基礎架構

1.1.nacos? 用于服務的注冊,作為注冊中心,同時也利用了nacos的熱更新特點,使用nacos作為配置中心。

1.2.Mysql 主要用了mqsql8.0版本,mysql作為關系型數據庫的存儲

1.3.MybatisPlus 主要使用了MybatisPlu實現對mysql數據庫的操作,實現增刪改查。

1.4.Oauth2.0 主要使用ouath2.0實現微服務的授權認證登錄。

1.5.消息隊列 rabbitMQ,應對物聯網設備數據并發的中間件,對設備數據進行排隊處理

1.6.emqx 主要用于設備的mqtt連接

2.模塊介紹:

2.1.auth模塊:主要是集成了數據庫的連接,以及ouath 的授權認證功能。

2.2.common模塊:作為公共模塊,為其他模塊提供基礎類以及公共依賴,降低代碼的耦合度

2.3.consumer模塊:消費者模塊,主要用于消費rabbitmq產生的數據信息。

2.4.mq模塊:主要用于設備處理設備上報的數據。

2.5.gateway模塊:主要作為接口請求統一入口,做鏈路追蹤,以及攔截請求。

2.6.system模塊:后臺管理平臺業務開發模塊。

代碼結構示意圖:

3.關鍵代碼講解

3.1基礎公共模塊(common)依賴:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.3.2.RELEASE</version><!-- lookup parent from repository --></parent><groupId>com.example</groupId><artifactId>common</artifactId><version>0.0.1-SNAPSHOT</version><name>common</name><description>Demo project for Spring Boot</description><url/><licenses><license/></licenses><developers><developer/></developers><scm><connection/><developerConnection/><tag/><url/></scm><properties><java.version>8</java.version></properties><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>Hoxton.SR8</version><type>pom</type><scope>import</scope></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-bootstrap</artifactId><version>3.0.0</version></dependency><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId><version>2.2.5.RELEASE</version></dependency><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId><version>2.2.5.RELEASE</version></dependency><!-- mybatis-plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.4.2</version></dependency><!-- mysql --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency><!-- lombok --><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency><!--阿里巴巴數據庫連接池--><dependency><groupId>com.alibaba</groupId><artifactId>druid-spring-boot-starter</artifactId><version>1.2.8</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-aop</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>

3.2網關相關依賴:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.3.2.RELEASE</version><!-- lookup parent from repository --></parent><groupId>com.example</groupId><artifactId>gateway</artifactId><version>0.0.1-SNAPSHOT</version><name>gateway</name><description>Demo project for Spring Boot</description><url/><licenses><license/></licenses><developers><developer/></developers><scm><connection/><developerConnection/><tag/><url/></scm><properties><java.version>8</java.version></properties><dependencies><dependency><groupId>com.example</groupId><artifactId>common</artifactId><version>0.0.1-SNAPSHOT</version><exclusions><exclusion><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></exclusion></exclusions></dependency><!--  網關配置--><!--網關發現服務后,進行負載均衡的轉發調用--><!--  <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-loadbalancer</artifactId><version>3.1.2</version></dependency>--><!--網關核心依賴--><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId><version>2.2.10.RELEASE</version><exclusions><exclusion><groupId>io.projectreactor.netty</groupId><artifactId>reactor-netty</artifactId></exclusion></exclusions></dependency><!--版本沖突報錯指定reactor-netty、spring-webflux版本--><dependency><groupId>org.springframework</groupId><artifactId>spring-webflux</artifactId><version>5.2.7.RELEASE</version></dependency><dependency><groupId>io.projectreactor.netty</groupId><artifactId>reactor-netty</artifactId><version>0.9.14.RELEASE</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>

3.3授權模塊(auth)依賴:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.3.2.RELEASE</version><!-- lookup parent from repository --></parent><groupId>com.example</groupId><artifactId>auth</artifactId><version>0.0.1-SNAPSHOT</version><name>auth</name><description>Demo project for Spring Boot</description><url/><licenses><license/></licenses><developers><developer/></developers><scm><connection/><developerConnection/><tag/><url/></scm><properties><java.version>8</java.version></properties><dependencies><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-oauth2</artifactId><version>2.2.5.RELEASE</version></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-security</artifactId><version>2.2.5.RELEASE</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency><!--   引入公共模塊--><dependency><groupId>com.example</groupId><artifactId>common</artifactId><version>0.0.1-SNAPSHOT</version></dependency><!--引入數據庫模塊--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>

3.4授權模塊核心配置類(AuthrizatonConfig):

package com.example.auth.config;import org.apache.http.protocol.HTTP;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
import org.springframework.security.oauth2.provider.ClientDetailsService;
import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices;
import org.springframework.security.oauth2.provider.code.InMemoryAuthorizationCodeServices;
import org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices;
import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.InMemoryTokenStore;
//訪問授權地址獲取授權碼 http://localhost:8063/oauth/authorize?client_id=test&response_type=code&scope=all&redirect_uri=http://www.baidu.com
@Configuration
@EnableAuthorizationServer
public class AuthrizatonConfig  extends AuthorizationServerConfigurerAdapter {@Autowiredprivate ClientDetailsService clientDetailsService;@Autowiredprivate AuthenticationManager authenticationManager;@Overridepublic void configure(AuthorizationServerSecurityConfigurer security) throws Exception {security//開啟tokenkey權限訪問.tokenKeyAccess("permitAll()").checkTokenAccess("permitAll()").allowFormAuthenticationForClients();}@Overridepublic void configure(ClientDetailsServiceConfigurer clients) throws Exception {clients.inMemory().withClient("test").secret(new BCryptPasswordEncoder().encode("123456")).resourceIds("auth","mq","gateway").authorizedGrantTypes("authorization_code","password","client_credentials","implicit","refresh_token").scopes("all").autoApprove(false).redirectUris("http://www.baidu.com");}/*** 令牌存儲策略* @return*/@Beanpublic TokenStore tokenStore(){return new InMemoryTokenStore();}@Beanpublic AuthorizationServerTokenServices tokenServices(){DefaultTokenServices services = new DefaultTokenServices();services.setSupportRefreshToken(true);services.setTokenStore(tokenStore());services.setAccessTokenValiditySeconds(60*60*60*2);services.setRefreshTokenValiditySeconds(60*60*24*3);return services;}public AuthorizationCodeServices authorizationCodeServices(){return  new InMemoryAuthorizationCodeServices();}@Overridepublic void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {endpoints.authorizationCodeServices(authorizationCodeServices()).authenticationManager(authenticationManager).tokenServices(tokenServices()).allowedTokenEndpointRequestMethods(HttpMethod.POST);}
}

3.4? SecurityConfig.java

package com.example.auth.config;import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;@Configuration
@EnableWebSecurity
public class SecurityConfig  extends WebSecurityConfigurerAdapter {/*** 密碼加密* @return*/@BeanPasswordEncoder passwordEncoder(){return new BCryptPasswordEncoder();}@Overrideprotected void configure(AuthenticationManagerBuilder auth) throws Exception {auth.inMemoryAuthentication().withUser("admin").password(new BCryptPasswordEncoder().encode("123456")).roles("admin");}@Overrideprotected void configure(HttpSecurity http) throws Exception {//允許表單登錄http.authorizeRequests().anyRequest().authenticated().and().formLogin().loginProcessingUrl("/login").permitAll().and().csrf().disable();}@Override@Beanpublic AuthenticationManager authenticationManagerBean() throws Exception {return super.authenticationManagerBean();}
}

?3.5 bootstrap的核心配置文件(其他服務配置類似這個):

server:port: 8061
spring:application:name: authprofiles:active:devcloud:nacos:config:file-extension: yaml#啟用配置熱更新功能refresh-enabled: trueprefix: authserver-addr: 192.168.1.24:8848discovery:instance-enabled: trueserver-addr: 192.168.1.24:8848cluster-name: authservice: auth-service

3.6nacos上面的配置文件如auth-dev.yaml

spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3306/auth?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&nullCatalogMeansCurrent=trueusername: rootpassword: Root@123type: com.alibaba.druid.pool.DruidDataSourcedruid:initial-size: 5min-idle: 1max-active: 10max-wait: 60000validation-query: SELECT 1 FROM DUALtest-on-borrow: falsetest-on-return: falsetest-while-idle: truetime-between-eviction-runs-millis: 60000
mysql:driver: com.mysql.jdbc.driver

3.7 consumer-dev.yaml

spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3306/auth?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&nullCatalogMeansCurrent=trueusername: rootpassword: Root@123type: com.alibaba.druid.pool.DruidDataSourcedruid:initial-size: 5min-idle: 1max-active: 10max-wait: 60000validation-query: SELECT 1 FROM DUALtest-on-borrow: falsetest-on-return: falsetest-while-idle: truetime-between-eviction-runs-millis: 60000

3.8 gateway-dev.yaml:

spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3306/gateway?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&nullCatalogMeansCurrent=trueusername: rootpassword: Root@123type: com.alibaba.druid.pool.DruidDataSourcedruid:initial-size: 5min-idle: 1max-active: 10max-wait: 60000validation-query: SELECT 1 FROM DUALtest-on-borrow: falsetest-on-return: falsetest-while-idle: truetime-between-eviction-runs-millis: 60000cloud:gateway:globalcors: # 全局的跨域配置# 解決options請求被攔截問題add-to-simple-url-handler-mapping: true # options請求 就是一種詢問服務器是否瀏覽器可以跨域的請求# 如果每次跨域都有詢問服務器是否瀏覽器可以跨域對性能也是損耗# 可以配置本次跨域檢測的有效期maxAge# 在maxAge設置的時間范圍內,不去詢問,統統允許跨域corsConfigurations:'[/**]':allowedOrigins:   # 允許哪些網站的跨域請求 - "http://localhost:8061"allowedMethods:   # 允許的跨域ajax的請求方式- "GET"- "POST"- "DELETE"- "PUT"- "OPTIONS"allowedHeaders: "*"  # 允許在請求中攜帶的頭信息allowCredentials: true # 允許在請求中攜帶cookiemaxAge: 360000    # 本次跨域檢測的有效期(單位毫秒)discovery:locator:enabled: trueroutes:#路由微服務名稱,- id: auth-service            #路由目標微服務 lb代表負載均衡協議uri: lb://auth-service        #以請求路徑做判斷,只要符合匹配規則的請求就會被轉發到上面信息對應的微服務中去  #路由斷言,判斷是否符合規則,符合規則路由到目標 predicates:                  - Path=/auth/**,/search/**            - id: consumer-serviceuri: lb://consumer-servicepredicates:- Path=/consumer/**- id: system-serviceuri: lb://system-servicepredicates:- Path=/system/**,/addresses/**- id: mq-serviceuri: lb://mq-servicepredicates:- Path=/mq/**#filters:                       # 過濾器,請求在傳遞過程中可以通過過濾器對其進行一定的修改# 轉發之前去掉1層路徑#- StripPrefix=1              default-filters:            #默認過濾器,對請求進行處理#在請求頭中添加信息,前鍵后值。- AddRequestHeader=headerName, project is well 

3.9mq-dev.yaml:

mq: dsswaz
spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3306/auth?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&nullCatalogMeansCurrent=trueusername: rootpassword: Root@123type: com.alibaba.druid.pool.DruidDataSourcedruid:initial-size: 5min-idle: 1max-active: 10max-wait: 60000validation-query: SELECT 1 FROM DUALtest-on-borrow: falsetest-on-return: falsetest-while-idle: truetime-between-eviction-runs-millis: 60000

4.授權認證模塊演示:

通過訪問http://localhost:8061/oauth/authorize?client_id=test&response_type=code&scope=all&redirect_uri=http://www.baidu.com

地址獲取code? 輸入賬戶 admin? 密碼:123456

4.1獲取到授權碼:

4.2 通過postman請求獲取access_token

4.2測試通過access_token訪問資源:

4.3 無token攜帶的時候,訪問服務資源

4.4 在指定模塊添加配置類(ResourceServerConfig):

package com.example.mq.config;import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
import org.springframework.security.oauth2.provider.token.RemoteTokenServices;@Configuration
@EnableResourceServer
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {@Beanpublic RemoteTokenServices tokenServices(){RemoteTokenServices tokenServices = new RemoteTokenServices();tokenServices.setCheckTokenEndpointUrl("http://localhost:8061/oauth/check_token");tokenServices.setClientId("test");tokenServices.setClientSecret("123456");return tokenServices;}@Overridepublic void configure(ResourceServerSecurityConfigurer resources) throws Exception {resources.resourceId("mq").tokenServices(tokenServices());}@Overridepublic void configure(HttpSecurity http) throws Exception {http.authorizeRequests().antMatchers("/**").access("#oauth2.hasScope('all')").anyRequest().authenticated();}
}

5.nacos相關配置,以及服務注冊情況

5.1nacos配置顯示:

5.2 nacos上服務顯示:

通過以上配置完成微服務框架的簡單auth2.0授權配置。

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/37547.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/37547.shtml
英文地址,請注明出處:http://en.pswp.cn/web/37547.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

防爆巡檢終端在石化工廠安全保障中的應用

防爆巡檢終端在石化工廠安全保障中的應用是廣泛而關鍵的&#xff0c;其設計旨在確保在易燃易爆環境中進行安全、有效的巡檢工作。以下是防爆巡檢終端在石化工廠安全保障中的詳細應用描述&#xff1a; 1. 環境監測與預警 防爆巡檢終端配備了各種傳感器&#xff0c;能夠實時監測…

網銀U盾多又亂?后悔沒早點用USB Server遠程連接管理!

一、引言 網銀服務已成為企業日常運營中不可或缺的一部分。但隨著企業規模的擴大和業務的增多&#xff0c;網銀U盾的數量也隨之激增&#xff0c;又多又亂&#xff0c;只能頻繁插拔、分散管理&#xff0c;不僅效率低下&#xff0c;而且存在嚴重的安全隱患。 事實上&#xff0…

ADS131A04硬件設計與軟件調試

一、IC基本信息 ADS131A0x 雙通道或四通道 24 位 128kSPS 同步采樣 Δ-Σ ADC ?雙通道或四通道同步采樣差分輸入 ? 數據速率&#xff1a;高達 128kSPS ? 高性能&#xff1a; – 單通道精度&#xff1a;在 10,000:1 動態范圍內優于 0.1% – 有效分辨率&#xff1a;20.6位…

SpringCloud-服務網關-Gateway

1.服務網關在微服務中的應用 (1)對外提供服務的難題分析&#xff1a; 微服務架構下的應用系統體系很龐大&#xff0c;光是需要獨立部署的基礎組件就有注冊中心、配置中心和服務總線、Turbine異常聚合和監控大盤、調用鏈追蹤器和鏈路聚合&#xff0c;還有Kaka和MQ之類的中間件&…

海思NNIE部署yolov5-shufflenet

1.簡要說明 由于NNIE上transpose支持的順序是固定的,shufflenet那種x=torch.transpose(x,1,2).contiguous() 的操作一般是不支持的。需要進行調整。 2.使用工程以及修改 使用的是開源工程:GitHub - Lufei-github/shufflev2-yolov5: shufflev2-yolov5:lighter, faster and ea…

c++應用網絡編程之一基本介紹

一、網絡編程介紹 c編程的應用場景在前面分析過&#xff0c;一個重要的方向就是網絡編程。一般來說&#xff0c;開發者說的服務端編程在c方向上簡單的可以認為是網絡編程。首先需要說明的&#xff0c;本系列不對網絡編程的相關基礎知識展開詳細的說明&#xff0c;因為這種知識…

瑪格家居從深交所轉板北交所:營收凈利潤連年下滑,銷售費用大增

《港灣商業觀察》施子夫 近日&#xff0c;瑪格家居股份有限公司&#xff08;以下簡稱&#xff0c;瑪格家居&#xff09;發布公告&#xff0c;重慶證監局已經受理其北交所上市的備案申請&#xff0c;輔導機構為國泰君安證券。 公開信息顯示&#xff0c;2022年1月&#xff0c;瑪…

【轉】Android靜態集成X5內核

項目中的老機器使用webview 無法加載vue3打包的網頁&#xff0c;只能用獨立的webview內核&#xff0c;采用靜態加載x5內核的方式&#xff0c; 以下內容轉自簡書作者漆先生的博客&#xff0c;僅用作備份記錄 之前在項目中在線集成的X5內核&#xff0c;但是效果不好&#xff0c;只…

基于STM32的智能電池管理系統

目錄 引言環境準備智能電池管理系統基礎代碼實現&#xff1a;實現智能電池管理系統 4.1 數據采集模塊4.2 數據處理與分析4.3 控制系統實現4.4 用戶界面與數據可視化應用場景&#xff1a;電池管理與優化問題解決方案與優化收尾與總結 1. 引言 智能電池管理系統&#xff08;Ba…

【昇思25天學習打卡營打卡指南-第十三天】ShuffleNet圖像分類

ShuffleNet圖像分類 ShuffleNet網絡介紹 ShuffleNetV1是曠視科技提出的一種計算高效的CNN模型&#xff0c;和MobileNet, SqueezeNet等一樣主要應用在移動端&#xff0c;所以模型的設計目標就是利用有限的計算資源來達到最好的模型精度。ShuffleNetV1的設計核心是引入了兩種操…

GPT-5 一年半后發布,打開人工智能新世紀

關于GPT-5一年半后發布的消息&#xff0c;這一預測主要基于OpenAI首席技術官Mira Murati的采訪和聲明。然而&#xff0c;需要明確的是&#xff0c;這個時間點&#xff08;即2025年底或2026年初&#xff09;已經與早期傳聞有所不同&#xff0c;顯示了OpenAI對產品質量的重視&…

react18.x+播放文本內容

需要調接口將文字傳遞給后端將文字轉換成音頻文件&#xff0c;然后播放&#xff0c;同時每次播放不同文本時&#xff0c;當前播放的文本需要暫停&#xff0c;切換到播放新點擊的文本 可以設置緩存播放過的音頻&#xff0c;也可以不設置緩存&#xff1a; 設置緩存的代碼如下&am…

驍龍相機拍照流程分析

和你一起終身學習&#xff0c;這里是程序員Android 經典好文推薦&#xff0c;通過閱讀本文&#xff0c;您將收獲以下知識點: 1.deliverInputEvent 拍照點擊事件處理 2.submitRequestList Camera 提交拍照請求 3.createCaptureRequest 拍照請求幀數 驍龍相機通過binder 數據傳輸…

idea 內存參數修改不生效問題解決 VM參數設置不生效解決

很多人配置idea 內存參數&#xff0c;怎么配置都不生效&#xff0c;主要原因是配置文件用的不是你修改的那個。 系統環境變量中的這個才是你真正要修改的配置文件。 找到并修改后保存&#xff0c;重啟idea就可生效

C++ | Leetcode C++題解之第208題實現Trie(前綴樹)

題目&#xff1a; 題解&#xff1a; class Trie { private:vector<Trie*> children;bool isEnd;Trie* searchPrefix(string prefix) {Trie* node this;for (char ch : prefix) {ch - a;if (node->children[ch] nullptr) {return nullptr;}node node->children[…

人工與智能系統之間的交互方式

人工與智能系統之間的交互方式 #mermaid-svg-xSsFZWak2bsyV0un {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-xSsFZWak2bsyV0un .error-icon{fill:#552222;}#mermaid-svg-xSsFZWak2bsyV0un .error-text{fill:#5522…

分詞算法在自然語言處理中的基本原理與應用場景

分詞算法在自然語言處理中的基本原理與應用場景 大家好&#xff0c;我是免費搭建查券返利機器人省錢賺傭金就用微賺淘客系統3.0的小編&#xff0c;也是冬天不穿秋褲&#xff0c;天冷也要風度的程序猿&#xff01; 分詞是自然語言處理&#xff08;NLP&#xff09;中的重要基礎…

python腳本 限制 外部訪問 linux服務器端口

注意&#xff1a;該腳本會清空linux防火墻的filter表的規則和用戶自定義鏈路 腳本的效果是將端口限制為僅服務器內部訪問&#xff0c;提高服務的安全性&#xff0c;穩定性 可以提供ip地址白名單 具體腳本&#xff1a; #!/usr/bin/python3 import argparse, subprocess, sys,…

13_網絡安全

目錄 網絡安全協議 網絡安全協議 PGP協議 網絡安全技術 防火墻技術 入侵檢測系統 入侵防御系統 殺毒軟件 蜜罐系統 計算機病毒與木馬 網絡安全協議 網絡安全協議 物理層主要使用物理手段隔離、屏蔽物理設備等&#xff0c;其他層都是靠協議來保證傳輸的安全&#xff…

美國服務器租用詳細介紹與租用流程

在數字化時代&#xff0c;服務器租用已成為許多企業和個人拓展業務、存儲數據的重要選擇。美國作為全球科技發展的前沿陣地&#xff0c;其服務器租用服務也備受矚目。下面&#xff0c;我們將詳細介紹美國服務器租用的相關知識及租用流程。 一、美國服務器租用簡介 美國服務器租…