Spring注册Bean的几种方式
通过XML配置注册Bean
spring-config.xml
<!--方式一:声明自定义的bean,没有设置id,id默认为全类型#编号--><bean id="cat" class="com.rzg.entity.Cat"/><bean class="com.rzg.entity.Cat"/>
public class SpringApp {public static void main(String[] args) {ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");String[] beanNames = context.getBeanDefinitionNames();for (String beanName : beanNames) {System.out.println(beanName);}}
}
使用@Component注解创建bean
用@Component注解创建beanm,前提是开启包扫描,开启包扫描有两种方式:xml注解开启
配置类开启
xml注解开启
spring-config.xml
<context:component-scan base-package="com.rzg"/>
Dog.java
@Component
public class Dog {private String dog;}
启动类
public class SpringApp {public static void main(String[] args) {ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");String[] beanNames = context.getBeanDefinitionNames();for (String beanName : beanNames) {System.out.println(beanName);}}
}
Spring配置类开启
SpringConfig.java
配置类
@ComponentScan("com.rzg")//开启包扫描
public class SpringConfig2 {
}
Dog.java
@Component
public class Dog {private String dog;}
启动类
public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);String[] beanNames = context.getBeanDefinitionNames();for (String beanName : beanNames) {System.out.println(beanName);}}
}
AnnotationConfigApplicationContext(SpringConfig2.class);方式启动的IOC容器,SpringConfig2可以不添加@Configuration注解和@Component注解,Spring会自动吧SpringConfig2加载到IOC容器中
@Component修饰的类或者类似上面SpringConfig配置的类,都可以在类中使用@Bean配置一个新的Bean,但是在这个新创建的Bean所在类中,无法再使用@Bean。
这里的@Component可以使xml注解开启的包扫描,也可以是XML配置开启的包扫描,用Spring配置类来开启包扫描,举例如下:
使用配置类的方式创建IOC容器
public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);String[] beanNames = context.getBeanDefinitionNames();for (String beanName : beanNames) {System.out.println(beanName);}}
}
在SpringConfig2中,使用@Bean创建了一个Bean。毫无疑问,配置类中使用@Bean可以帮我们创建一个bean。
@ComponentScan("com.rzg")
public class SpringConfig2 {@Beanpublic Rabbit rabbit(){return new Rabbit();}}
由于这个配置类开启了ComponentScan,下面我们使用@Component创建一个Dog Bean
@Component
public class Dog {private String dog;@Beanpublic Cat cat(){return new Cat();}
}
在这个@Component创建的Bean的所在类中,仍然可以使用@Bean创建新的Bean。那么在这个Cat Bean所在类中,是否还能用@Bean创建bean呢?答案是不能
。
补充
FactoryBean
spring提供了一个接口FactoryBean,也可以用于声明bean,只不过实现了FactoryBean接口的类造出来的对象不是当前类的对象,而是FactoryBean接口泛型指定类型的对象。如下列,造出来的bean并不是DogFactoryBean,而是Dog。有什么用呢?可以在对象初始化前做一些事情,下例中的注释位置就是让你自己去扩展要做的其他事情的。
启动类
public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);String[] names = context.getBeanDefinitionNames();for (String name : names) {System.out.println(name);}System.out.println(context.getBean("dogFactory").getClass().getName());}
}
输出结果:
springConfig2
dogFactory
com.rzg.entity.Dog
配置类
定义了一个DogFactory
public class SpringConfig2 {@Beanpublic DogFactory dogFactory(){return new DogFactory();}
}
DogFactory.java
public class DogFactory implements FactoryBean<Dog> {@Overridepublic Dog getObject() throws Exception {Dog dog = new Dog();dog.setName("小黑");/* 其他的操作 */return dog;}@Overridepublic Class<?> getObjectType() {return Dog.class;}@Overridepublic boolean isSingleton() {return FactoryBean.super.isSingleton();}
}
FactoryBean也是一个bean,只不过它用于生产其他的bean。需要注意的是,IOC容器中并没有这个工厂bean,只有其生产的Bean
@ImportResource
原有的xml配置的Spring项目怎么转换成Java配置类转换的项目。使用@ImportResource放在配置类上,传入XML的文件路径即可
配置类
@ImportResource("spring-config.xml")
public class SpringConfig2 {}
启动类
public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);String[] beanNames = context.getBeanDefinitionNames();for (String beanName : beanNames) {System.out.println(beanName);}}
}
@Configuration
前面的例子中用到了@Configuration这个注解,当我们使用AnnotationConfigApplicationContext加载配置类的时候,配置类可以不添加这个注解。但是这个注解有一个更加强大的功能,它可以保障配置类中使用方法创建的bean的唯一性。为@Configuration注解设置proxyBeanMethods属性值为true即可,由于此属性默认值为true,所以很少看见明确书写的,除非想放弃此功能。
看下面的例子
public class Cat {
}@Configuration(proxyBeanMethods = true)
public class SpringConfig2 {@Beanpublic Cat cat(){return new Cat();}
}
public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);SpringConfig2 bean = context.getBean(SpringConfig2.class);System.out.println(bean.cat());System.out.println(bean.cat());System.out.println(bean.cat());}
}
输出结果:
com.rzg.entity.Cat@7fe8ea47
com.rzg.entity.Cat@7fe8ea47
com.rzg.entity.Cat@7fe8ea47
输出结果为什么会不一样呢。
如果配置类是一个普通类SpringConfig2 ,那么每调用一次cat方法,会产生一个新的cat对象。但是SpringConfig2作为普通类,并将proxyBeanMethods 设置为true(这也是默认值),那么获取SpringConfig2的Bean后调用cat方法,会由Spring代理,每次调用都会返回同一个IOC容器中的bean。如果proxyBeanMethods设置为false,则不使用代理,每次调用cat方法会像普通方法一样,返回一个全新的cat对象。
@Import注入Bean
在配置类上使用@Import可以精确导入指定的Bean,只需要给@Import传入指定的类对象数组,同样也可以导入工厂类,只不过这个工厂生产出来的Bean Name为工厂类的全类名。
public class Cat {
}
public class DogFactory implements FactoryBean<Dog> {@Overridepublic Dog getObject() throws Exception {Dog dog = new Dog();dog.setName("小黑");/* 其他的操作 */return dog;}@Overridepublic Class<?> getObjectType() {return Dog.class;}@Overridepublic boolean isSingleton() {return FactoryBean.super.isSingleton();}
}@Import({Cat.class,Cat.class,DogFactory.class})
public class SpringConfig2 {}public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);String[] names = context.getBeanDefinitionNames();for (String name : names) {System.out.println(name);}System.out.println("----------------");Object bean = context.getBean("com.rzg.entity.DogFactory");System.out.println(bean.getClass().getName());}
}输出结果:
springConfig2
com.rzg.entity.Cat
com.rzg.entity.DogFactory
----------------
com.rzg.entity.Dog
如果生产多个相同类型的Bean,后面的Bean会把前面的Bean覆盖掉
还需要注意 @Import导入的类可以作为一个配置类。看下面例子
我们知道在通过配置类启动的Spring程序,可以在配置类上省略@Configuration注解,Spring仍然可以作为一个配置类使用。比如在配置类上使用@ComponentScan标签。
public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);String[] names = context.getBeanDefinitionNames();for (String name : names) {System.out.println(name);}System.out.println("----------------");}
}@ComponentScan("com.rzg.entity")
public class SpringConfig2 {@Bean Cat cat(){return new Cat();}
}
使用@Component方式加载的bean和@Import加载的bean仍然可以作为配置类,像下面这样
public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);String[] names = context.getBeanDefinitionNames();for (String name : names) {System.out.println(name);}System.out.println("----------------");}
}@ComponentScan("com.rzg.entity") //会将Rabbit 扫描到,但是不会扫描到SpringConfig
public class SpringConfig2 {}@Component//使用@Component方式导入的bean,仍然可以用作配置类
@ComponentScan("com.rzg.config")//会扫描到SpringConfig
public class Rabbit {}@Component
public class SpringConfig {}
输出结果:
springConfig2
rabbit
springConfig
@Import方式
public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);String[] names = context.getBeanDefinitionNames();for (String name : names) {System.out.println(name);}System.out.println("----------------");}
}@Import({Rabbit.class})
public class SpringConfig2 {}@Component
@ComponentScan("com.rzg.config")
public class Rabbit {}
@Component
public class SpringConfig {
}输出结果:
springConfig2
springConfig
com.rzg.entity.Rabbit
暂且将@Bean方式产生的bean作为普通bean,@Component和@Import方式产生的Bean作为配置Bean。因为@Component和@Import方式产生的bean可以放@ComponentScan(“”)注解,@Bean方式产生的Bean,放@ComponentScan没有作用。
那么@Import导入的类可以作为配置类的话,在这个类上是否可以继续用@Import导入其他Bean,答案是当然可以。
public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);String[] names = context.getBeanDefinitionNames();for (String name : names) {System.out.println(name);}System.out.println("----------------");}
}public class SpringConfig2 {@Beanpublic Rabbit rabbit(){return new Rabbit();}
}@Component
@ComponentScan("com.rzg.config")
public class Rabbit {}@Component
public class SpringConfig {
//在com.rzg.config包下,但是不会产生类,因为给@Bean普通类添加@ComponentScan没作用
}输出结果:
springConfig2
rabbit
编程方式加载Bean
在ioc容器产生之后,可以动态的添加bean
public class SpringConfig2 {}
public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);String[] names = context.getBeanDefinitionNames();for (String name : names) {System.out.println(name);}System.out.println("----------------");context.register(Rabbit.class);names = context.getBeanDefinitionNames();for (String name : names) {System.out.println(name);}}
}
主要输出结果:
springConfig2
----------------
springConfig2
rabbit
ImportSelector
实现了ImportSelector的类,作为一个ImportSelector,可以一次性导入多个Bean。实现这个接口中的selectImports方法,返回String数组,数组中放置要导入的全类名。ImportSelector和工厂类似
,但是注意实现ImportSelector接口的类,只能通过@Import注解来导入。@Import应该是和ImportSelector配合使用的,@Import导入/ImportSelector导入时选择嘛。
public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);String[] names = context.getBeanDefinitionNames();for (String name : names) {System.out.println(name);}System.out.println("----------------");}@Import(MyImportSelector.class)
public class SpringConfig2 {}public class MyImportSelector implements ImportSelector {@Overridepublic String[] selectImports(AnnotationMetadata importingClassMetadata) {//importingClassMetadata存放了一些配置类SpringConfig2的一些信息,包括是否有某些注解return new String[]{"com.rzg.entity.Cat","com.rzg.entity.Dog"};}@Overridepublic Predicate<String> getExclusionFilter() {return ImportSelector.super.getExclusionFilter();}
}主要输出结果:
springConfig2
com.rzg.entity.Cat
com.rzg.entity.Dog
----------------
ImportBeanDefinitionRegistrar接口
bean的加载不是一个简简单单的对象,spring中定义了一个叫做BeanDefinition的东西,它才是控制bean初始化加载的核心。BeanDefinition接口中给出了若干种方法,可以控制bean的相关属性。说个最简单的,创建的对象是单例还是非单例,在BeanDefinition中定义了scope属性就可以控制这个。如果你感觉方式六没有给你开放出足够的对bean的控制操作,那么方式七你值得拥有。我们可以通过定义一个类,然后实现ImportBeanDefinitionRegistrar接口的方式定义bean,并且还可以让你对bean的初始化进行更加细粒度的控制,不过对于新手并不是很友好。忽然给你开放了若干个操作,还真不知道如何下手。
public class MyRegistrar implements ImportBeanDefinitionRegistrar {@Overridepublic void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder.rootBeanDefinition(Cat.class).getBeanDefinition();registry.registerBeanDefinition("cat",beanDefinition);}
}@Import(MyRegistrar.class)
public class SpringConfig2 {}public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);String[] names = context.getBeanDefinitionNames();for (String name : names) {System.out.println(name);}System.out.println("----------------");}
}
主要运行结果:
springConfig2
cat
----------------
BeanDefinitionRegistryPostProcessor
如果在一个项目开发中,很多开发者在自己模块定义一些Bean,那么造成一些冲突怎么办,Bean的定义有前后顺序的话,岂不是很难控制。BeanDefinitionRegistryPostProcessor就是帮我们在一些bean定义之后再去定义一些Bean,他的定义是在以上几种Bean定义方式之后。
public class SpringApp02 {public static void main(String[] args) {AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig2.class);String[] names = context.getBeanDefinitionNames();for (String name : names) {System.out.println(name);}System.out.println("----------------");}
}@Import(MyPostProcessor.class)
public class SpringConfig2 {}public class MyPostProcessor implements BeanDefinitionRegistryPostProcessor {@Overridepublic void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry beanDefinitionRegistry) throws BeansException {BeanDefinition beanDefinition =BeanDefinitionBuilder.rootBeanDefinition(Cat.class).getBeanDefinition();beanDefinitionRegistry.registerBeanDefinition("cat",beanDefinition);}@Overridepublic void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {}
}springConfig2
com.rzg.entity.MyPostProcessor
cat
----------------
相关文章:
Spring注册Bean的几种方式
通过XML配置注册Bean spring-config.xml <!--方式一:声明自定义的bean,没有设置id,id默认为全类型#编号--><bean id"cat" class"com.rzg.entity.Cat"/><bean class"com.rzg.entity.Cat"/>public class SpringApp…...

Egg:使用joi进行参数校验以及注册接口小demo
目录 前言: 准备工作: 前端代码: 后端目录截图: 1.获取参数 2.校验参数 3.查询数据库中是否已经存在该用户 4.用户入库 5.测试一哈 添加用户成功 同样的用户名再注册一遍 编辑总结: 前言: 在阅…...
天梯赛训练L1-016(查验身份证)
目录 1、L1-016 查验身份证 2、如果帮助到大家了,希望大家一键三连!!! 1、L1-016 查验身份证 分数 15 题目通道 一个合法的身份证号码由17位地区、日期编号和顺序编号加1位校验码组成。校验码的计算规则如下: 首…...
技术方案评审
目录 参考一、流程&规范二、评审维度组件选型性能可伸缩性灵活性可扩展性可靠性安全性兼容性弹性处理事务性可测试性可运维性监控三、方案模板背景目标整体架构业务流程接口定义数据库表功能实现测试计划人力排期Check List整体评估<...

Python机器学习库scikit-learn在Anaconda中的配置
本文介绍在Anaconda环境中,安装Python语言scikit-learn模块的方法。 scikit-learn库(简称sklearn)是一个基于Python语言的机器学习库,提供了各种机器学习算法和相关工具,包括分类、回归、聚类、降维、模型选择和预处理…...
yarn init 没有 ts 类型声明
yarn 版本为 3. 的初始化项目里,我们下载的包会发现没有 ts 类型提示。那么跟着我做这几个命令,就可以轻松搞定,具体原因我就不贴了,如果有兴趣可以评论问这里只写 vscode 没有提示的修复方式yarn add typescript -Dyarn dlx yarn…...
孩子喜欢打人父母要怎么引导?听听专家的小建议
随着人们生活水平的提高。有些孩子被父母宠坏了,不仅脾气暴躁,还喜欢打人。面对这种情况,许多家长会选择暴制暴,导致孩子更崇尚暴力。被打后,孩子不仅没有悔改,而且变得更糟。即使孩子被说服了,…...
Hive中order by,sort by,distribute by,Cluster by
order by 对数据进行全局排序, 只有一个reducer Task, 效率低 mysql中strict模式下, order by必须要有limit, 不然会拒绝执行. 对于分区表, 必须显示指定分区字段查询。 sort by 可以有多个reduce Task(以distribute by后的字段个数为准) 每个reduce Task内部数据有序, 但…...

PyTorch的自动微分(autograd)
PyTorch的自动微分(autograd) 计算图 计算图是用来描述运算的有向无环图 计算图有两个主要元素:结点(Node)和边(Edge) 结点表示数据,如向量、矩阵、张量 边表示运算,如加减乘除卷积等 用计算…...
sum-check protocol
sumcheck是一个交互式证明协议,给定域F上的多元多项式g(x1,...,xv)g(x_1,...,x_v)g(x1,...,xv),证明者Prover可以向验证者Verifier证明该多项式ggg的遍历求和值等于公开值HHH,即 H∑b1,b2,...,bv∈{0,1}vg(b1,b2,...,bv)H \sum_{b_1,b_2,…...

数据结构刷题(二十一):131分割回文串、78子集
1.分割回文串题目链接思路:回溯算法的组合方法(分割问题类似组合问题)。流程图:红色竖杠就是startIndex。 for循环是横向走,递归是纵向走。回溯三部曲:递归函数参数:字符串s和startIndex&#…...

Spring Aop 详解
主要内容: 了解Spring AOP的概念及其术语熟悉Spring AOP的JDK动态代理熟悉Spring AOP的CGLib动态代理掌握基于XML的AOP实现掌握基于注解的AOP实现AOP用官方话来说: AOP即面向切面编程。和OOP(面向对象编程)不同,AOP主…...
【数据库死锁】线上问题之数据库死锁
原本平静的一天,惊现生产项目瘫痪问题,马上打开日志,发现后台日志提示了多个“com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction” 大概去了解一下这个异常&#x…...

好友管理系统--课后程序(Python程序开发案例教程-黑马程序员编著-第4章-课后作业)
实例3:好友管理系统 如今的社交软件层出不穷,虽然功能千变万化,但都具有好友管理系统的基本功能,包括添加好友、删除好友、备注好友、展示好友等。下面是一个简单的好友管理系统的功能菜单,如图1所示。 图1 好友管理系…...
Redis 集群 Redis Cluster搭建
Redis集群需要至少三个master节点,我们这里搭建三个master节点192.168.20.130,192.168.20.131,192.168.20.132,并且给每个master再搭建一个slave节点(一个节点一主一从,通过端口号区分)…...

博客系统(前后端分离版)
博客系统的具体实现 文章目录博客系统的具体实现软件开发的基本流程具体实现的八大功能数据库设计创建数据库操作数据库引入依赖封装DataSource创建实体类将JDBC增删改查封装起来实现博客列表页web.xml的配置文件实现博客系统的展示功能登录功能强制要求用户登录显示用户信息退…...

第十二章 opengl之模型加载(Assimp)
OpenGLAssimp模型加载库构建Assimp网格网格渲染Assimp 我们不太能够对像是房子、汽车或者人形角色这样的复杂形状手工定义所有的顶点、法线和纹理坐标。我们要的是将这些模型(Model)导入(Import)到程序当中。模型通常都由3D艺术家在Blender、3DS Max或者Maya这样的工具中精心制…...
Stable Matching-稳定匹配问题【G-S算法,c++】
Stable Matching-稳定匹配问题【G-S算法,c】题目描述:(Gale-Shapley算法)解题思路一:G-S算法(Gale-Shapley算法)题目描述:(Gale-Shapley算法) Teenagers from the local high school have asked you to help them with the organ…...

TypeScript(四)接口
目录 前言 定义 用法 基本用法 约定规则 属性控制 任意属性 可选属性 只读属性 定义函数 冒号定义 箭头定义 接口类型 函数接口 索引接口 继承接口 类接口 总结 前言 在介绍TS对象类型中,为了让数组每一项更具体,我们使用 string [ ]…...
Python-基础知识
目录 Python 简介 Python 发展历史 Python 特点 Python 标识符 Python 保留字符 行和缩进 多行语句 Python 引号 Python注释 Python 简介 Python 是一个高层次的结合了解释性、编译性、互动性和面向对象的脚本语言。 Python 的设计具有很强的可读性,相比…...

8k长序列建模,蛋白质语言模型Prot42仅利用目标蛋白序列即可生成高亲和力结合剂
蛋白质结合剂(如抗体、抑制肽)在疾病诊断、成像分析及靶向药物递送等关键场景中发挥着不可替代的作用。传统上,高特异性蛋白质结合剂的开发高度依赖噬菌体展示、定向进化等实验技术,但这类方法普遍面临资源消耗巨大、研发周期冗长…...

Day131 | 灵神 | 回溯算法 | 子集型 子集
Day131 | 灵神 | 回溯算法 | 子集型 子集 78.子集 78. 子集 - 力扣(LeetCode) 思路: 笔者写过很多次这道题了,不想写题解了,大家看灵神讲解吧 回溯算法套路①子集型回溯【基础算法精讲 14】_哔哩哔哩_bilibili 完…...

学校招生小程序源码介绍
基于ThinkPHPFastAdminUniApp开发的学校招生小程序源码,专为学校招生场景量身打造,功能实用且操作便捷。 从技术架构来看,ThinkPHP提供稳定可靠的后台服务,FastAdmin加速开发流程,UniApp则保障小程序在多端有良好的兼…...

MMaDA: Multimodal Large Diffusion Language Models
CODE : https://github.com/Gen-Verse/MMaDA Abstract 我们介绍了一种新型的多模态扩散基础模型MMaDA,它被设计用于在文本推理、多模态理解和文本到图像生成等不同领域实现卓越的性能。该方法的特点是三个关键创新:(i) MMaDA采用统一的扩散架构…...

Psychopy音频的使用
Psychopy音频的使用 本文主要解决以下问题: 指定音频引擎与设备;播放音频文件 本文所使用的环境: Python3.10 numpy2.2.6 psychopy2025.1.1 psychtoolbox3.0.19.14 一、音频配置 Psychopy文档链接为Sound - for audio playback — Psy…...
JAVA后端开发——多租户
数据隔离是多租户系统中的核心概念,确保一个租户(在这个系统中可能是一个公司或一个独立的客户)的数据对其他租户是不可见的。在 RuoYi 框架(您当前项目所使用的基础框架)中,这通常是通过在数据表中增加一个…...

算法岗面试经验分享-大模型篇
文章目录 A 基础语言模型A.1 TransformerA.2 Bert B 大语言模型结构B.1 GPTB.2 LLamaB.3 ChatGLMB.4 Qwen C 大语言模型微调C.1 Fine-tuningC.2 Adapter-tuningC.3 Prefix-tuningC.4 P-tuningC.5 LoRA A 基础语言模型 A.1 Transformer (1)资源 论文&a…...

AI病理诊断七剑下天山,医疗未来触手可及
一、病理诊断困局:刀尖上的医学艺术 1.1 金标准背后的隐痛 病理诊断被誉为"诊断的诊断",医生需通过显微镜观察组织切片,在细胞迷宫中捕捉癌变信号。某省病理质控报告显示,基层医院误诊率达12%-15%,专家会诊…...
快刀集(1): 一刀斩断视频片头广告
一刀流:用一个简单脚本,秒杀视频片头广告,还你清爽观影体验。 1. 引子 作为一个爱生活、爱学习、爱收藏高清资源的老码农,平时写代码之余看看电影、补补片,是再正常不过的事。 电影嘛,要沉浸,…...
嵌入式常见 CPU 架构
架构类型架构厂商芯片厂商典型芯片特点与应用场景PICRISC (8/16 位)MicrochipMicrochipPIC16F877A、PIC18F4550简化指令集,单周期执行;低功耗、CIP 独立外设;用于家电、小电机控制、安防面板等嵌入式场景8051CISC (8 位)Intel(原始…...