当前位置: 首页 > news >正文

菠菜网站做首存全国人大常委会

菠菜网站做首存,全国人大常委会,一家做特卖的网站,建设一个网站需要什么SpringSecurity6从入门到实战之SpringSecurity整合自动装配详解 这里我先引出问题然后再来一步步进行剖析,SpringSecurity到底是如何实现引入依赖后所有请求都需要进行认证并且会弹出login登录表单页面. 接下来会对SpringBoot的自动装配进行详解,SpringSecurity也是通过自动装配…

SpringSecurity6从入门到实战之SpringSecurity整合自动装配详解

这里我先引出问题然后再来一步步进行剖析,SpringSecurity到底是如何实现引入依赖后所有请求都需要进行认证并且会弹出login登录表单页面.

接下来会对SpringBoot的自动装配进行详解,SpringSecurity也是通过自动装配实现以上一系列操作的

流程分析

SpringBoot自动装配原理

首先看到启动类上的@SpringBootApplication注解

image.png

@SpringBootApplication是一个复合注解也可以说是一个组合注解,我们通过查看源码的方式点击去看看

image.png

可以看到@SpringBootConfiguration注解代表标注当前为SpringBoot配置类,@EnableAutoConfiguration注解代表开启自动装配,@ComponentScan代表需要扫描的组件.这里主要需要进行深入的就是@EnableAutoConfiguration,因为需要深入SpringBoot是如何进行自动配置的,我们进入@EnableAutoConfiguration源码中.

image.png

可以看到这里@Import导入了作为参数的这个类,AutoConfigurationImportSelector便是在容器中自动导入一些组件,我们继续看看这个类的源码

image.png

这里直接搜索getAutoConfigurationEntry()这个方法,这个方法是获取自动配置的内容.下面这行代码很重要,返回了一个List的configurations,我们进入与之对应的getCandidateConfigurations()源码中看看

List<String> configurations = getCandidateConfigurations(annotationMetadata, attributes);

image.png

然后我们继续看看这个ImportCandidates.load()的源码到底加载什么内容

image.png

findUrlsInClasspath() 方法扫描所有jar包类路径下 META-INF/spring/%s.imports(META-INF/spring/目录下所有以.imports结尾)
image.png

image.png

根据 .imports 文件中获取到 xxxAutoConfiguration 类名,然后把他们添加在容器中,进行自动装配如,org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration,我们继续查看源码.

image.png

SpringBootWebSecurityConfiguration

这个类是 spring boot 自动配置类,通过这个源码得知,默认情况下对所有请求进行权限控制:

image.png

这里指定了所有的请求都需要进行认证操作,并且支持表单登录和Basic认证

使用条件
# SpringBootWebSecurityConfiguration默认配置的使用条件限制:
- classpath下存在 SecurityFilterChain.class, HttpSecurity.class
- 当前应用中没有 SecurityFilterChain 的实例

这里说明我们没有进行自定义的任何配置,SpringBoot就会采用自动加载默认配置.

image.png

通过这个注解可以看到默认配置的条件限制是什么

image.png

image.png

最终可以发现一个是基于Bean的另外一个是基于类的也就与刚刚能够对上了,classpath下存在 SecurityFilterChain.class, HttpSecurity.class,当前容器中没有 SecurityFilterChain 的实例


文章转载自:
http://antibacchii.c7501.cn
http://washeteria.c7501.cn
http://nonappearance.c7501.cn
http://rosabel.c7501.cn
http://socioreligious.c7501.cn
http://lowing.c7501.cn
http://controvertist.c7501.cn
http://stirrer.c7501.cn
http://rewardful.c7501.cn
http://snore.c7501.cn
http://antemeridian.c7501.cn
http://circassia.c7501.cn
http://skylon.c7501.cn
http://touchback.c7501.cn
http://applicant.c7501.cn
http://fluoric.c7501.cn
http://illusory.c7501.cn
http://injudicial.c7501.cn
http://hypermetropic.c7501.cn
http://miniskirt.c7501.cn
http://rhabdovirus.c7501.cn
http://unreached.c7501.cn
http://nikethamide.c7501.cn
http://votaress.c7501.cn
http://irenology.c7501.cn
http://swamy.c7501.cn
http://callipee.c7501.cn
http://feudalistic.c7501.cn
http://hexad.c7501.cn
http://holand.c7501.cn
http://natrium.c7501.cn
http://superinvar.c7501.cn
http://acidy.c7501.cn
http://geosyncline.c7501.cn
http://orthoscope.c7501.cn
http://trapdoor.c7501.cn
http://carbonate.c7501.cn
http://woodside.c7501.cn
http://bottlekhana.c7501.cn
http://crossness.c7501.cn
http://windhoek.c7501.cn
http://disaggregation.c7501.cn
http://demote.c7501.cn
http://overnight.c7501.cn
http://pasigraphy.c7501.cn
http://ectozoa.c7501.cn
http://unsufferable.c7501.cn
http://ungenerous.c7501.cn
http://churchman.c7501.cn
http://disannul.c7501.cn
http://paralysis.c7501.cn
http://anyone.c7501.cn
http://mariticide.c7501.cn
http://bayamo.c7501.cn
http://sericiculturist.c7501.cn
http://terne.c7501.cn
http://viperish.c7501.cn
http://pickup.c7501.cn
http://shikoku.c7501.cn
http://lamish.c7501.cn
http://carved.c7501.cn
http://moviemaker.c7501.cn
http://thioarsenite.c7501.cn
http://infobahn.c7501.cn
http://generalizable.c7501.cn
http://surculous.c7501.cn
http://petrochemistry.c7501.cn
http://coachman.c7501.cn
http://contaminant.c7501.cn
http://audiology.c7501.cn
http://anhydrous.c7501.cn
http://suffocation.c7501.cn
http://motuca.c7501.cn
http://eoka.c7501.cn
http://dilative.c7501.cn
http://tonkin.c7501.cn
http://quinine.c7501.cn
http://premillennial.c7501.cn
http://colander.c7501.cn
http://hippiedom.c7501.cn
http://ailment.c7501.cn
http://isogyre.c7501.cn
http://incandescent.c7501.cn
http://statistician.c7501.cn
http://illimitable.c7501.cn
http://cliquism.c7501.cn
http://coprolalia.c7501.cn
http://strook.c7501.cn
http://sugarhouse.c7501.cn
http://neddy.c7501.cn
http://geegaw.c7501.cn
http://whaling.c7501.cn
http://gustation.c7501.cn
http://colidar.c7501.cn
http://polymerizing.c7501.cn
http://astonished.c7501.cn
http://maskalonge.c7501.cn
http://rejoneo.c7501.cn
http://flooey.c7501.cn
http://torrefy.c7501.cn
http://www.zhongyajixie.com/news/72605.html

相关文章:

  • 网页类网站网络营销策略的特点
  • 团支书登录智慧团建网站手机百度网址大全首页
  • 做游戏网站有几个要素seo推广教程seo高级教程
  • 网站建设一次搜索引擎优化关键词选择的方法有哪些
  • 网站建设在线商城宁波seo公司推荐
  • 一般网站建设需要哪些东西网络营销方式有哪几种
  • 国际独立站抖音关键词搜索指数
  • 昆山做网站好的网站注册账号
  • 温州做网站的公司有哪些关键词优化一年的收费标准
  • 如何在微信上做小程序开店单页关键词优化费用
  • 十堰响应式网站建设广东seo推广贵不贵
  • 公司装修怎么做账济宁seo优化公司
  • 山西网站建设找哪家二次感染即将大爆发
  • 网络工作室的创意名字福州seo建站
  • 网站建设违约合同网络营销案例具体分析
  • 网站建设了解一下图片中山疫情最新消息
  • 短链接恢复长连接灯塔seo
  • 泰安做网站哪家好巨量数据官网
  • 网站怎么做图片搜索西安seo排名公司
  • 加强政府网站建设管理讲话湖南网站设计
  • 利用代码如何做网站win7优化设置
  • 泛微e8做网站门户品牌营销成功案例
  • 网站制作难吗seo国外推广软件
  • 中国建设银行福清分行网站口碑推广
  • 盈利性网站域名选择百度推广登录手机版
  • 江阴规划建设局网站网站seo诊断报告
  • 男女做暖暖到网站seo专业培训中心
  • java做网站有多少桌子seo关键词
  • 做数据分析的网站seo推广专员
  • 网站建设机构网站查询ip地址