SpringBoot整合Oauth2开放平台接口授权案例
<!-- SpringBoot整合Web组件 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><!-- springboot整合freemarker --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-freemarker</artifactId></dependency><!-->spring-boot 整合security --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-security</artifactId></dependency><!-- spring-cloud-starter-oauth2 --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-oauth2</artifactId></dependency>
二、授权中心案例代码
Oauth2相关配置:
/*** @author Mr.Zheng* @Program: parent* @Description: 配置授权中心信息* @date 2020-05-03 13:21*/
@Configuration
@EnableAuthorizationServer
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {/*** accessToken有效期 两小时*/private int accessTokenValiditySeconds = 7200;/*** refreshToken有效期 两小时*/private int refreshTokenValiditySeconds = 7200;/*** 添加商户信息** @param clients 商户* @throws Exception 异常*/@Overridepublic void configure(ClientDetailsServiceConfigurer clients) throws Exception {clients.inMemory()//商户id.withClient("client_1")//商户secret.secret(passwordEncoder().encode("123456"))//回调地址.redirectUris("https://www.baidu.com/")/* OAuth2为我们提供了四种授权方式:* 1、授权码模式(authorization code)用在客户端与服务端应用之间授权* 2、简化模式(implicit)用在移动app或者web app(这些app是在用户的设备上的,如在手机上调起微信来进行认证授权)* 3、密码模式(resource owner password credentials)应用直接都是受信任的(都是由一家公司开发的)* 4、客户端模式(client credentials)用在应用API访问*/.authorizedGrantTypes("password", "client_credentials", "refresh_token", "authorization_code")//授权范围.scopes("all")//accessToken有效期.accessTokenValiditySeconds(accessTokenValiditySeconds)//refreshToken有效期.refreshTokenValiditySeconds(refreshTokenValiditySeconds);}/*** 设置token类型* @param endpoints*/@Overridepublic void configure(AuthorizationServerEndpointsConfigurer endpoints) {endpoints.authenticationManager(authenticationManager()).allowedTokenEndpointRequestMethods(HttpMethod.GET,HttpMethod.POST);endpoints.authenticationManager(authenticationManager());endpoints.userDetailsService(userDetailsService());}@Overridepublic void configure(AuthorizationServerSecurityConfigurer oauthServer) {// 允许表单认证oauthServer.allowFormAuthenticationForClients();// 允许check_token访问oauthServer.checkTokenAccess("permitAll()");}@BeanAuthenticationManager authenticationManager() {AuthenticationManager authenticationManager = new AuthenticationManager() {@Overridepublic Authentication authenticate(Authentication authentication) throws AuthenticationException {return daoAuhthenticationProvider().authenticate(authentication);}};return authenticationManager;}@Beanpublic AuthenticationProvider daoAuhthenticationProvider() {DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();daoAuthenticationProvider.setUserDetailsService(userDetailsService());daoAuthenticationProvider.setHideUserNotFoundExceptions(false);daoAuthenticationProvider.setPasswordEncoder(passwordEncoder());return daoAuthenticationProvider;}/*** 设置添加用户信息,正常应该从数据库中读取** @return UserDetailsService*/@BeanUserDetailsService userDetailsService() {InMemoryUserDetailsManager userDetailsService = new InMemoryUserDetailsManager();userDetailsService.createUser(User.withUsername("user_1").password(passwordEncoder().encode("123456")).authorities("ROLE_USER").build());userDetailsService.createUser(User.withUsername("user_2").password(passwordEncoder().encode("1234567")).authorities("ROLE_USER").build());return userDetailsService;}/*** 设置加密方式** @return PasswordEncoder*/@BeanPasswordEncoder passwordEncoder() {return new BCryptPasswordEncoder();}
}
Security相关配置:
/*** @author Mr.Zheng* @Program: parent* @Description: 添加Security权限配置* @date 2020-05-03 13:59*/
@Component
public class SecurityConfig extends WebSecurityConfigurerAdapter {/*** 授权中心管理器* @return AuthenticationManager* @throws Exception 异常*/@Bean@Overridepublic AuthenticationManager authenticationManagerBean() throws Exception {return super.authenticationManagerBean();}@Beanpublic PasswordEncoder passwordEncoder() {return new BCryptPasswordEncoder();}/*** 拦截所有请求,使用httpBasic方式登陆* @param http 请求* @throws Exception 异常*/@Overrideprotected void configure(HttpSecurity http) throws Exception {http.authorizeRequests().antMatchers("/**").fullyAuthenticated().and().httpBasic();}}
测试授权码模式:
访问http://localhost:8080/oauth/authorize?response_type=code&client_id=client_1&redirect_uri=https://www.baidu.com/
使用该授权码获取accessToken:
访问http://localhost:8080/oauth/token?grant_type=authorization_code&client_id=client_1&client_secret=123456&code=EwaTib&redirect_uri=https://www.baidu.com/&scope=all
测试密码模式获取accessToken:
三、受保护应用端案例代码
全局配置:
server:port: 8081logging:level:org.springframework.security: DEBUGsecurity:oauth2:resource:####从认证授权中心上验证tokentokenInfoUri: http://localhost:8080/oauth/check_tokenpreferTokenInfo: trueclient:accessTokenUri: http://localhost:8080/oauth/tokenuserAuthorizationUri: http://localhost:8080/oauth/authorize###appidclientId: client_1###appSecretclientSecret: 123456
资源拦截配置:
/*** @author Mr.Zheng* @Program: parent* @Description: 资源拦截配置* @date 2020-05-03 15:43*/
@Configuration
@EnableResourceServer
public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter {@Overridepublic void configure(HttpSecurity http) throws Exception {// 对 api/order 请求进行拦截http.authorizeRequests().antMatchers("/api/test/**").authenticated();}}
资源服务请求测试类:
/*** @author Mr.Zheng* @Program: parent* @Description:* @date 2020-05-03 15:44*/
@RestController
@RequestMapping("/api/test")
public class TestController {@RequestMapping("/add")public String addOrder() {return "add success!";}
启动类开启Oauth2
/*** @author Mr.Zheng* @Program: parent* @Description:* @date 2020-05-03 15:42*/
@SpringBootApplication
@EnableOAuth2Sso
public class TestOauth2Server {public static void main(String[] args) {SpringApplication.run(TestOauth2Server.class,args);}
}
四、授权中心和受保护应用端联合测试
1)、没授权时:
2)、授权时:
先获取token
再用token访问资源
五、修改授权中心改成动态数据库查询的方式
下载官方数据库脚本:spring-security-oauth/schema.sql at main · spring-attic/spring-security-oauth · GitHub
新增数据库依赖:
<!-- mysql --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-jdbc</artifactId></dependency>
spring:datasource:hikari:connection-test-query: SELECT 1minimum-idle: 1maximum-pool-size: 5pool-name: dbcp1driver-class-name: com.mysql.jdbc.Driverurl: jdbc:mysql://localhost:3306/zhq_test_oauth?autoReconnect=true&useSSL=falseusername: rootpassword: root
修改Oauth2配置:
/*** @author Mr.Zheng* @Program: parent* @Description: 配置授权中心信息* @date 2020-05-03 13:21*/
@Configuration
@EnableAuthorizationServer
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {@Autowired@Qualifier("dataSource")private DataSource dataSource;/*** accessToken有效期 两小时*/private int accessTokenValiditySeconds = 7200;/*** refreshToken有效期 两小时*/private int refreshTokenValiditySeconds = 7200;@Beanpublic TokenStore tokenStore() {// return new InMemoryTokenStore(); //使用内存中的 token storereturn new JdbcTokenStore(dataSource); /// 使用Jdbctoken store}/*** 添加商户信息** @param clients 商户* @throws Exception 异常*/@Overridepublic void configure(ClientDetailsServiceConfigurer clients) throws Exception {clients.jdbc(dataSource)//测试首次运行可以指定测试数据,如果数据库中没有则不报错,如果有或者第二次运行会报错,因为数据库已经存在了,需要注释掉.withClient("client_1")//商户secret.secret(passwordEncoder().encode("123456"))//回调地址.redirectUris("https://www.baidu.com/")/* OAuth2为我们提供了四种授权方式:* 1、授权码模式(authorization code)用在客户端与服务端应用之间授权* 2、简化模式(implicit)用在移动app或者web app(这些app是在用户的设备上的,如在手机上调起微信来进行认证授权)* 3、密码模式(resource owner password credentials)应用直接都是受信任的(都是由一家公司开发的)* 4、客户端模式(client credentials)用在应用API访问*/.authorizedGrantTypes("password", "client_credentials", "refresh_token", "authorization_code")//授权范围.scopes("all")//accessToken有效期.accessTokenValiditySeconds(accessTokenValiditySeconds)//refreshToken有效期.refreshTokenValiditySeconds(refreshTokenValiditySeconds);}/*** 设置token类型* @param endpoints*/@Overridepublic void configure(AuthorizationServerEndpointsConfigurer endpoints) {endpoints.authenticationManager(authenticationManager()).allowedTokenEndpointRequestMethods(HttpMethod.GET,HttpMethod.POST);endpoints.authenticationManager(authenticationManager());endpoints.userDetailsService(userDetailsService());}@Overridepublic void configure(AuthorizationServerSecurityConfigurer oauthServer) {// 允许表单认证oauthServer.allowFormAuthenticationForClients();// 允许check_token访问oauthServer.checkTokenAccess("permitAll()");}@BeanAuthenticationManager authenticationManager() {AuthenticationManager authenticationManager = new AuthenticationManager() {@Overridepublic Authentication authenticate(Authentication authentication) throws AuthenticationException {return daoAuhthenticationProvider().authenticate(authentication);}};return authenticationManager;}@Beanpublic AuthenticationProvider daoAuhthenticationProvider() {DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();daoAuthenticationProvider.setUserDetailsService(userDetailsService());daoAuthenticationProvider.setHideUserNotFoundExceptions(false);daoAuthenticationProvider.setPasswordEncoder(passwordEncoder());return daoAuthenticationProvider;}/*** 设置添加用户信息,正常应该从数据库中读取** @return UserDetailsService*/@BeanUserDetailsService userDetailsService() {InMemoryUserDetailsManager userDetailsService = new InMemoryUserDetailsManager();userDetailsService.createUser(User.withUsername("user_1").password(passwordEncoder().encode("123456")).authorities("ROLE_USER").build());userDetailsService.createUser(User.withUsername("user_2").password(passwordEncoder().encode("1234567")).authorities("ROLE_USER").build());return userDetailsService;}/*** 设置加密方式** @return PasswordEncoder*/@BeanPasswordEncoder passwordEncoder() {return new BCryptPasswordEncoder();}
}
测试运行:
检查数据库发现测试商户已经导入到数据库了
相关文章:
![](https://img-blog.csdnimg.cn/d6cbceb9cf564574bd0cad74cb047398.png)
SpringBoot整合Oauth2开放平台接口授权案例
<!-- SpringBoot整合Web组件 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.projectlombok</groupId>&l…...
![](https://www.ngui.cc/images/no-images.jpg)
Linux_创建用户
创建一个名为hello的用户,并指定/home/hello为根目录useradd -d /home/hello -m hello 设置密码 ,密码会输入两次,一次设置密码,一次确认密码,两次密码要输入的一样passwd hellouseradd的常用参数含义-d指定用户登入时的主目录&am…...
![](https://img-blog.csdnimg.cn/f25dec5be4e549f3b71b71626e2b2c1d.png)
RDD(弹性分布式数据集)总结
文章目录一、设计背景二、RDD概念三、RDD特性四、RDD之间的依赖关系五、阶段的划分六、RDD运行过程七、RDD的实现一、设计背景 1.某些应用场景中,不同计算阶段之间会重用中间结果,即一个阶段的输出结果会作为下一个阶段的输入。如:迭代式算法…...
![](https://img-blog.csdnimg.cn/img_convert/c80dfe51f82e7901659629f3c6738331.png)
服务器版RstudioServer安装与配置详细教程
Docker部署Rstudio server 背景:如果您想在服务器上运行RstudioServer,可以按照如下方法进行操作,笔者测试时使用腾讯云服务器(系统centos7),需要在管理员权限下运行 Rstudio 官方提供了使用不同 R 版本的 …...
![](https://www.ngui.cc/images/no-images.jpg)
如何在Java中将一个列表拆分为多个较小的列表
在Java中,有多种方法可以将一个列表拆分为多个较小的列表。在本文中,我们将介绍三种不同的方法来实现这一目标。 方法一:使用List.subList()方法 List接口提供了一个subList()方法,它可以用来获取列表中的一部分元素。我们可以使…...
![](https://img-blog.csdnimg.cn/12d3c32a656342909bf75cbb47ae0d8c.png)
TryHackMe-Inferno(boot2root)
Inferno 现实生活中的机器CTF。该机器被设计为现实生活(也许不是?),非常适合刚开始渗透测试的新手 “在我们人生旅程的中途,我发现自己身处一片黑暗的森林中,因为直截了当的道路已经迷失了。我啊…...
![](https://www.ngui.cc/images/no-images.jpg)
微信原生开发中 JSON配置文件的作用 小程序中有几种JSON配制文件
关于json json是一种数据格式,在实际开发中,JSON总是以配制文件的形式出现,小程序与不例外,可对项目进行不同级别的配制。Q:小程序中有几种配制文件A:小程序中有四种配制文件分别是:project.config.json si…...
![](https://www.ngui.cc/images/no-images.jpg)
【python】为什么使用python Django开发网站这么火?
关注“测试开发自动化” 弓中皓,获取更多学习内容) Django 是一个基于 Python 的 Web 开发框架,它提供了许多工具和功能,使开发者可以更快地构建 Web 应用程序。以下是 Django 开发中的一些重要知识点: MTV 模式&#…...
![](https://img-blog.csdnimg.cn/3b8eac671492422a956eba00f1006f91.png)
Java设计模式(五)—— 责任链模式
责任链模式定义如下:使多个对象都有机会处理请求,从而避免请求的发送者与接收者之间的耦合关系。将这些对象连成一条链,并沿着这条链传递该请求,知道有一个对象处理它为止。 适合使用责任链模式的情景如下: 有许多对…...
![](https://www.ngui.cc/images/no-images.jpg)
VMLogin:虚拟浏览器提供的那些亮眼的功能
像VMLogin这样的虚拟浏览器具有多种功能,如安全的浏览环境、可定制的设置、跨平台的兼容性、更快的浏览速度、广告拦截等等。 虚拟浏览器的不同功能可以为您做什么? 使用虚拟浏览器是浏览互联网和完成其他任务的安全方式,没有风险。您可以在…...
![](https://www.ngui.cc/images/no-images.jpg)
第一个错误的版本
题目 你是产品经理,目前正在带领一个团队开发新的产品。不幸的是,你的产品的最新版本没有通过质量检测。由于每个版本都是基于之前的版本开发的,所以错误的版本之后的所有版本都是错的。 假设你有 n 个版本 [1, 2, …, n],你想找出…...
![](https://img-blog.csdnimg.cn/623115940ca04093afd6b959a57fcadd.png)
2023爱分析·AIGC市场厂商评估报告:拓尔思
AIGC市场定义 市场定义: AIGC,指利用自然语言处理技术(NLP)、深度神经网络技术(DNN)等人工智能技术,基于与人类交互所确定的主题,由AI算法模型完全自主、自动生成内容,…...
![](https://www.ngui.cc/images/no-images.jpg)
MobTech|场景唤醒的实现
什么是场景唤醒? 场景唤醒是moblink的一项核心功能,可以实现从打开的Web页面,一键唤醒App,并恢复对应的场景。 场景是指用户在App内的某个特定页面或状态,比如商品详情页、活动页、个人主页等。每个场景都有一个唯一…...
![](https://img-blog.csdnimg.cn/5eda415957624e09a51921216ee7bd47.jpeg)
不在路由器上做端口映射,如何访问局域网内网站
假设现在外网有一台ADSL直接拨号上网的电脑,所获得的是公网IP。然后它想访问局域网内的电脑上面的网站,那么就需要在路由器上做端口映射。在路由器上做端口映射的具体规则是:将所有发向自己端口的数据,都转发到内网的计算机。 访…...
![](https://img-blog.csdnimg.cn/img_convert/8ca91fed20fffd0a9ce41456b803c1ef.png)
ChatGPT 辅助科研写作
前言 总结一些在科研写作中 ChatGPT 的功能,以助力提升科研写作的效率。 文章目录前言一、ChatGPT 简介1. ChatGPT 普通版与 Plus 版的区别1)普通账号2)Plus账号二、New Bing 简介1. 快速通过申请三、辅助学术写作1. 改写论文表述2. 语言润色…...
![](https://img-blog.csdnimg.cn/img_convert/1bd45ed34baf757d07012e09a5d40142.png)
MySQL最大建议行数 2000w,靠谱吗?
本文已经收录到Github仓库,该仓库包含计算机基础、Java基础、多线程、JVM、数据库、Redis、Spring、Mybatis、SpringMVC、SpringBoot、分布式、微服务、设计模式、架构、校招社招分享等核心知识点,欢迎star~ Github地址 1 背景 作为在后端圈开车的多年…...
![](https://img-blog.csdnimg.cn/80840d0c54704fcd951104a452692bee.png)
【Tomcat 学习】
Tomcat 学习 笔记记录一、Tomcat1. Tomcat目录2. Tomcat启动3. Tomcat部署项目4. 解决Tomcat启动乱码问题5. JavaWeb项目创建部署6. 打war包发布项目7. Tomcat配置文件8. Tomcat配置虚拟目录(不用在webapps目录下)9. Tomcat配置虚拟主机10. 修改web项目默认加载资源路径一、Tom…...
![](https://img-blog.csdnimg.cn/img_convert/c2e49115ba7224f14f12d04e86e7c71f.png)
重装系统如何做到三步装机
小白三步版在给电脑重装系统的过程中,它会提供系统备份、还原和重装等多种功能。下面也将介绍小白三步版的主要功能,以及使用技巧和注意事项。 主要功能 系统备份和还原:小白三步版可以帮助用户备份系统和数据,以防止重要数据丢失…...
![](https://img-blog.csdnimg.cn/802bb6e6a57945bc8fc3c11525dd7316.png)
蓝桥杯单片机第十一届省赛客观题(深夜学习——单片机)
第一场 (1)模电——》多级放大电路 阻容耦合,只通交流,不通直流。 变压器耦合,只通交流,不通直流。 光电耦合,主要是起隔离作用,更多的用在非线性的应用电路中 (2&a…...
![](https://www.ngui.cc/images/no-images.jpg)
Pandas对Excel文件进行读取、增删、打开、保存等操作的代码实现
文章目录前言一、Pandas 的主要函数包括二、使用步骤1.简单示例2.保存Excel操作3.删除和添加数据4.添加新的表单总结前言 Pandas 是一种基于 NumPy 的开源数据分析工具,用于处理和分析大量数据。Pandas 模块提供了一组高效的工具,可以轻松地读取、处理和…...
![](https://img-blog.csdnimg.cn/9d10c067afac480da5501089b72494fe.png)
js常见的9种报错记录一下
js常见报错语法错误(SyntaxError)类型错误(TypeError)引用错误(ReferenceError)范围错误(RangeError)运行时错误(RuntimeError)网络错误(NetworkError)内部错误(InternalError)URI错误(URIError)eval错误&a…...
![](https://img-blog.csdnimg.cn/d644ba219b1e478892d96299f8b94ca6.png)
ORACLE not available报错处理办法
用sqlplus的时候 连接用户总是出现ORACLE not available 解决办法: 第一步: 请输入用户名: sys as sysdba 输入口令: 已连接到空闲例程。 第二步: 先连接到管理员用户下将用例开启 SQL> startup; ORACLE 例程已经启动。 然后就会出现一下 Total S…...
![](https://img-blog.csdnimg.cn/278325f3ada346f78bf33d6186443d1d.png)
【Pandas】Python中None、null和NaN
经常混淆。 空值一般表示数据未知、不适用或将在以后添加数据。缺失值指数据集中某个或某些属性的值是不完整的。 一般空值使用None表示,缺失值使用NaN表示。 注意: python中没有null,但是有和其意义相近的None。 目录 1、None 2. NaN …...
![](https://img-blog.csdnimg.cn/d0a6abc4debd446e97d95911b6505cf0.png)
线性表的学习
线性表定义 n个类型相同数据元素的有限序列,记作:a0,a1,a2,a3,...ai-1,ai,ai1...an-1(这里的0,1,2,3,i-1,i,i1,n-1都是元素的序号) 特点 除第一个元素无直接前驱。最后一个元素无直接后续&am…...
![](https://img-blog.csdnimg.cn/img_convert/073f8a1d91905175d5464d85b4ceec31.png)
51单片机学习笔记_13 ADC
ADC 使得调节开发板上的电位器时,数码管上能够显示 AD 模块 采集电位器的电压值且随之变化。 开发板上有三个应用:光敏电阻,热敏电阻,电位器。 一般 AD 转换有多个输入,提高使用效率。 ADC 通过地址锁存与译码判断采…...
![](https://www.ngui.cc/images/no-images.jpg)
类和对象的基本认识之内部类
什么是内部类?当一个事物的内部,还有一个部分需要一个完整的结构进行描述,而这个内部的完整的结构又只为外部事物提供服 务,那么这个内部的完整结构最好使用内部类。在 Java 中,可以将一个类定义在另一个类或者一个方法…...
![](https://img-blog.csdnimg.cn/img_convert/b53e31f8e6491c5fc87d581a8693ebd8.png)
【操作系统】进程和线程是什么之间是如何通信的
文章目录1、进程1.1、什么是进程1.2、进程的状态1.3、进程的控制结构1.4、进程的控制1.5、进程的上下文切换1.6、进程上下文切换场景1.7、进程间通信2、线程2.1、什么是线程2.2、线程的上下文切换2.3、线程间通信3、线程与进程的联系1、进程 1.1、什么是进程 进程(process) 是…...
![](https://img-blog.csdnimg.cn/474438106a744d8995b1db718a06ac56.png)
setup、ref、reactive、computed
setup 理解:Vue3.0 中一个新的配置项,值为一个函数 setup 是所有 Composition API(组合API)“表演的舞台” 组件中所用到的数据、方法等,均要配置在 setup 中 setup 函数的两种返回值: 若返回一个对象…...
![](https://www.ngui.cc/images/no-images.jpg)
【Gem5】有关gem5模拟器的资料导航
网上有关gem5模拟器的资料、博客良莠不齐,这里记录一些总结的很好的博客与自己的学习探索。 一、gem5模拟器使用入门 官方的教程: learning_gem5:包括gem5简介、修改扩展gem5的示例、Ruby相关的缓存一致性等。gem5 Documentation࿱…...
![](https://img-blog.csdnimg.cn/c3abf551994346a4828914b6739250ed.png)
【CSS】清除浮动 ① ( 清除浮动简介 | 清除浮动语法 | 清除浮动 - 额外标签法 )
文章目录一、清除浮动简介二、清除浮动语法三、清除浮动 - 额外标签法1、额外标签法 - 语法说明2、问题代码示例3、额外标签法代码示例一、清除浮动简介 在开发页面时 , 遇到下面的情况 , 父容器 没有设置 内容高度 样式 , 容器中的 子元素 设置了 浮动样式 , 脱离了标准流 , …...
![](/images/no-images.jpg)
WordPress修改页眉/重庆seo软件
职称计算机考试:也叫:全国专业技术人员计算机应用能力考试,是根据国家人事部及各省人事厅的规定,专业技术人员评聘职称必须通过人事局计算机考试。全国专业技术人员计算机应用能力考试采用科目模块化设计,每一科目(模块…...
![](/images/no-images.jpg)
cf租号网站怎么做的/沈阳网站关键词优化公司
一、前言这些天忙着写业务代码,曹工说Tomcat系列暂时没时间写,先随便写点其他的。里面提到了:两个线程,交替打印奇偶数这道笔试题。update on 2020/6/7,下面的第二种方式,现在回头看,其实感觉写…...
![](/images/no-images.jpg)
做英文网站賺钱/企业网站优化服务
在一个springmvc(spring是3.0版本,其对应的thyemleaf也应该是spring3的版本)项目中添加thyemleaf时候,出现这个错误, Cannot convert value of type [org.apache.shiro.cache.ehcache.EhCacheManager] to required typ…...
![](/images/no-images.jpg)
wordpress app theme/官方百度app下载安装
文章目录1、安装服务2、制作证书3、服务配置附件HTTPS - Hyper Text Transfer Protocol over SecureSocket Layer,是以安全为目标的HTTP通道,在HTTP的基础上通过传输加密和身份认证保证了传输过程的安全性;HTTPS在HTTP的基础下加入SSL层&…...
![](/images/no-images.jpg)
做网站和优化共多少钱?/seo视频
# Celery ## 1.什么是Celery Celery是一个简单、灵活且可靠的,处理大量消息的分布式系统 专注于实时处理的异步任务队列 同时也支持任务调度 ### Celery架构 ![20150314100608_187](C:\Users\Administrator\Desktop\celery和hystack\20150314100608_187.png) Celery…...
![](/images/no-images.jpg)
游戏门户网站 织梦/重庆seo整站优化方案范文
题意:一棵带边权的树,边权可单边修改,问初始时和每次修改后有多少条路径$\gcd1$ 首先考虑用反演求答案,设$f(n)$为路径$\gcdn$的路径条数,$g(n)$为路径$\gcd$是$n$倍数的路径条数,那么$g(n)\sum\limits_{n|…...