Spring学习笔记——2

news2024/10/6 6:02:40

Spring学习笔记——2

  • 1、Bean的基本注解开发
    • 1.1、注解版本和@Component简介
    • 1.2、@Component使用
    • 1.3、@Component的三个衍生注解
  • 二、Bean依赖注入注解开发
    • 2.1、依赖注入相关注解
    • 2.2、@Autowired扩展
  • 三、非自定义Bean注解开发
  • 四、Bean配置类的注解开发
  • 五、Spring注解的解析原理
  • 六、Spring注解方式整合第三方框架
    • 6.1、注解方式整合Mybatis代码实现
    • 6.2、@Import整合第三方框架原理

1、Bean的基本注解开发

1.1、注解版本和@Component简介

Spring除了xml配置文件进行配置之外,还可以使用注解方式进行配置,注解方式慢慢成为xml配置的替代方案。我们有了xml开发的经验,学习注解开发就方便了许多,注解开发更加快捷方便。

Spring提供的注解有三个版本:

  • 2.0时代,Spring开始出现注解
  • 2.5时代,Spring的Bean配置可以使用注解完成
  • 3.0时代,Spring其他配置也可以使用注解完成,我们进入全注解时代

基本Bean注解,主要是使用注解的方式替代原有xml的<bean>标签及其标签属性的配置

<bean id="" name="" class="" scope="" lazy-init="" init-method="" destroy-method=""abstract="" autowire="" factory-bean="" factory-method=""></bean>

使用@Component注解替代<bean>标签

xml配置注解描述
<bean id=“” class=“”>@Component被该注解表示的类,会在指定扫描范围内被Spring加载并实例化

例:

//<bean id="userDao" class="com.Smulll.Dao.Impl.UserDaoImpl"></bean>
@Component("userDao")
public class UserDaoImpl implements UserDao{
    @Override
    public void show() {
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd">

    <!--注解组件扫描-->
    <!--扫描指定的基本包及其子包下的类,识别使用@Component注解-->
    <context:component-scan base-package="com.Smulll"/>
</beans>
public class test1 {
    @Test
    public void exp1(){
        ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("beans.xml");
        Object bean = classPathXmlApplicationContext.getBean("userDao");
        System.out.println(bean);
    }
}

1.2、@Component使用

  • 如果@Component不设置name属性,那会回自动将首字母小写的类名转化成name

使用@Component注解替代<bean>标签

xml配置注解描述
<bean scope="">@Scope在类上或使用了@Bean标注的方法上,标注Bean的作用范围,取值为singleton或prototype
<bean lazy-init="">@Lazy在类上或使用了@Bean标注的方法上,标注Bean是否延迟加载,取值为true和false
<bean init-method="">@PostConstruct在方法上使用,标注Bean的实例化后执行的方法
<bean destroy-method="">@PreDestroy在方法上使用,标注Bean的销毁前执行方法
//<bean id="userDao" class="com.Smulll.Dao.Impl.UserDaoImpl"></bean>
@Component("userDao")
@Scope("singleton")
@Lazy(true)
public class UserDaoImpl implements UserDao{
    @Override
    public void show() {
    }
    public UserDaoImpl(){
        System.out.println("实例化完成");
    }
    @PostConstruct
    public void init(){
        System.out.println("执行初始化方法。。。");
    }
    @PreDestroy
    public void destroy(){
        System.out.println("执行销毁方法。。。");
    }
}

1.3、@Component的三个衍生注解

由于JavaEE开发是分层的,为了每层Bean标识的注解语义化更加明确
@Component又衍生出如下三个注解:

@Component衍生注解描述
@Repository在Dao层类上使用
@Service在Service层类上使用
@Controller在Web层类上使用
@Service("userService")
public class UserServiceImpl implements UserService{}
@Repository("userDao")
public class UserDaoImpl implements UserDao{}
@Controller("userService")
public class UserController{}

二、Bean依赖注入注解开发

2.1、依赖注入相关注解

Bean依赖注入的注解,主要是使用注解的方式替代xml的<property>标签完成属性的注入操作

<bean id=" "class="">
	<property name="" value=""/>
	<property name="" ref=""/>
</bean>

Spring主要提供如下注解,用于在Bean内部进行属性注入的:

属性注入注解描述
@Value使用在字段或方法上,用于注入普通数据
@Autowired使用在字段或方法上,用于根据类型(byType)注入引用数据
@Qualifier使用在字段或方法上,结合@Autowired,根据名称注入
@Resource使用在字段或方法上,根据类型或名称进行注入
  • @Value一般会引用Spring容器里面的一些值,根据key进行获取
  • @Autowired根据类型进行注入,如果同一类型的Bean有多个,尝试根据名字进行二次匹配,如果匹配不成功则会报错
  • 配合使用@Qualifier注解,可以在同一类型的多个Bean中根据名称注入相应的Bean
  • @Resource不指定名称参数时,根据类型注入,指定名称则根据名称注入
@Repository("userDao")
public class UserDaoImpl implements UserDao{}
@Repository("userDao2")
public class UserDaoImpl implements UserDao{}
@Service("userService")
public class UserServiceImpl implements UserService{

    @Value("zhangsan")
    private String username;
    
    //@Autowired //如果同一类型的Bean有多个,尝试根据名字进行二次匹配,如果匹配不成功则会报错
    //@Qualifier("userDao2") //配合使用@Autowired注解,可以在同一类型的多个Bean中根据名称注入相应的Bean
    @Resource //不指定名称参数时,根据类型注入,指定名称则根据名称注入
    private UserDao userDao;
    @Override
    public void show() {
        System.out.println(username);
        System.out.println(userDao);
    }
}

2.2、@Autowired扩展

  • @Autowired使用该注解时,所查看的是参数的类型,跟方法的名称无关
@Service("userService")
public class UserServiceImpl implements UserService{
    @Autowired 
    public void xxx(UserDao userDao) {
        System.out.println("xxx:"+userDao);
    }
}
  • 该注解同样可以获取一个集合,可以将同一类型的多个Bean打印出来
@Service("userService")
public class UserServiceImpl implements UserService{
    @Autowired 
    public void yyy(List<UserDao> userDaoList) {
        System.out.println("yyy:"+userDaoList);
    }
}

三、非自定义Bean注解开发

非自定义Bean不能像自定义Bean一样使用@Component进行管理,非自定义Bean要通过工厂的方式进行实例化,使用@Bean标注方法即可,@Bean的属性为beanName,如不指定为当前工厂方法名称

//将方法返回值Bean实例以@Bean注解指定的名称存储到spring容器中
@Bean ("datasource")
public DataSource dataSource (){
	DruidDataSource dataSource = new DruidDataSource();
	dataSource.setDriverClassName("com.mysql.jdbc.Driver");
	dataSource.setUrl("jdbc:mysql://localhost:3306/mybatis");
	dataSource.setUsername("root");
	dataSource.setPassword("123456");
	return dataSource;
}
  • @Bean标注后面不加name值,则将类名赋值为name属性值

在参数中注入

@Component
public class otherBean {
    @Bean("dataSource")
    public DataSource dataSource(
   		@Value("${jdbc.driver}") String driver
   		@Qualifier("userDao") UserDao UserDao//不需要写@Autowired
	){
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
        dataSource.setUrl("jdbc:mysql://localhost:3306/mybatis");
        dataSource.setUsername("root");
        dataSource.setPassword("123456");
        return dataSource;
    }
}

四、Bean配置类的注解开发

@Component等注解替代了<bean>标签,但是像<import><context:componentScan>等非<bean>标签怎样去使用注解替代呢?

    <!--注解组件扫描-->
    <!--扫描指定的基本包及其子包下的类,识别使用@Component注解-->
    <context:component-scan base-package="com.Smulll"/>
    <!--加载properties文件-->
    <context:property-placeholder location="classpath:jdbc.properties"/>
    <!--引入其他xml文件-->
    <import resource="classpath:beans.xml">

定义一个配置类替代原有的xml配置文件,<bean>标签以外的标签,一般都是在配置类上使用注解完成的

需要在配置类上加 @Configuration

作用:

  1. 标识该类是一个配置类
  2. 使其具备@Component作用
xml配置注解描述
<context:component-scan base-package="com.Smulll"/>@ComponentScan组件扫描配置
<context:property-placeholder location="classpath:jdbc.properties"/>@PropertySource获取到properties文件里的信息
<import resource="classpath:beans.xml">@Import导入其他的xml配置文件

base-package的配置方式:

  • 指定一个或多个包名:扫描指定包及其子包下使用注解的类
  • 不配置包名:扫描当前@componentScan注解配置类所在包及其子包下的类
@Configuration
//<context:component-scan base-package="com.Smulll"/>
@ComponentScan(basePackages = {"com.Smulll"})//扫描包
//<context:property-placeholder location="classpath:jdbc.properties"/>
@PropertySource({"classpath:jdbc.properties"})
//<import resource=""/>
@Import(otherBean.class)
public class SpringConfig {}

配置其他注解

扩展:@Primary注解用于标注相同类型的Bean优先被使用权,@Primary 是Spring3.0引入的,与@Component和@Bean一起使用,标注该Bean的优先级更高,则在通过类型获取Bean或通过@Autowired根据类型进行注入时,会选用优先级更高的

@Repository("userDao")
public class UserDaoImpl implements UserDao{}
@Repository("userDao2")
@Primary
public class UserDaoImpl2 implements UserDao{}
@Bean("dataSource")
public DataSource dataSource(){}

@Bean("dataSource2")
@Primary
public DataSource dataSource2(){}

扩展:@Profile注解的作用同于xml配置时学习profile属性,是进行环境切换使用的

<beans profile="test">

注解@Profile标注在类或方法上,标注当前产生的Bean从属于哪个环境,只有激活了当前环境,被标注的Bean才能被注册到Spring容器里,不指定环境的Bean,任何环境下都能注册到Spring容器里

@Repository("userDao")
@Profile("test")
public class UserDaoImpl implements UserDao{}
@Repository("userDao2")
public class UserDaoImpl2 implements UserDao{}

可以使用以下两种方式指定被激活的环境:

  • 使用命令行动态参数,虚拟机参数位置加载 -Dspring.profiles.active=test
  • 使用代码的方式设置环境白能量System.setProperty("profiles.active","test");
@Test
public void exp2(){
    System.setProperty("spring.profiles.active","test");
    AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
    Object userDao = annotationConfigApplicationContext.getBean("userDao");
    System.out.println(userDao);
}

五、Spring注解的解析原理

在这里插入图片描述
结论:只要将Bean对应的BeanDefinition注册到beanDefinitionMap中,就可以经历整个SpringBean的生命周期,最终实例化进入单例池中

使用@Component等注解配置完毕后,要配置组件扫描才能使注解生效

  • xml配置组件扫描:
<context:component-scan base-package="com.Smulll"/>
  • 配置类配置组件扫描:
@Configuration
@ComponentScan("com.Smulll")
public class AppConfig {
}

六、Spring注解方式整合第三方框架

6.1、注解方式整合Mybatis代码实现

第三方框架整合,依然使用MyBatis作为整合对象,之前我们已经使用xml方式整合了MyBatis,现在使用注解方式无非就是将xml标签替换为注解,将xml配置文件替换为配置类而已,原有xml方式整合配置如下:

<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
    <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"></property>
    <property name="url" value="jdbc:mysql://localhost:3306/mybatis2"></property>
    <property name="username" value="root"></property>
    <property name="password" value="123456"></property>
</bean>
<!--配置SqlSessionFactoryBean,作用将SqlSessionFactory存储到spring容器-->
<bean class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource"></property>
</bean>
<!--MapperScannerConfigurer,作用扫描指定的包,产生Mapper对象存储到Spring容器-->
<bean  class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <property name="basePackage" value="com.Smulll.mapper"></property>
</bean>

使用注解方式:

注解方式,Spring整合MyBatis的原理,关键在于**@MapperScan**,@MapperScan不是Spring提供的注解,是MyBatis为了整合Spring,在整合包org.mybatis.spring.annotation中提供的注解,源码如下:

package com.Smulll.config;

import com.Smulll.Bean.otherBean;
import com.alibaba.druid.pool.DruidDataSource;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.*;

import javax.sql.DataSource;

@Configuration
//<context:component-scan base-package="com.Smulll"/>
@ComponentScan(basePackages = {"com.Smulll"})//扫描包
//<context:property-placeholder location="classpath:jdbc.properties"/>
@PropertySource({"classpath:jdbc.properties"})
//<import resource=""/>
@Import(otherBean.class)
//Mapper接口扫描
@MapperScan("com.Smulll.mapper")

public class SpringConfig {
    @Bean
    public DataSource dataSource(
            @Value("${jdbc.driver}") String driver,
            @Value("${jdbc.url}") String Url,
            @Value("${jdbc.username}") String username,
            @Value("${jdbc.password}") String password
    ){
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setDriverClassName(driver);
        dataSource.setUrl(Url);
        dataSource.setUsername(username);
        dataSource.setPassword(password);

        return dataSource;
    }
    @Bean
    public SqlSessionFactoryBean sqlSessionFactoryBean(DataSource dataSource){
        SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
        sqlSessionFactoryBean.setDataSource(dataSource);
        return sqlSessionFactoryBean;
    }
}

重点关注一下@lmport({MapperScannerRegistrar.class),当@MapperScan被扫描加载时,会解析@Import注解,从而加载指定的类,此处就是加载了MapperScannerRegistrar

6.2、@Import整合第三方框架原理

Spring与MyBatis注解方式整合有个重要的技术点就是@Import,第三方框架与Spring整合xml方式很多是凭借自定义标签完成的,而第三方框架与Spring整合注解方式很多是靠@Import注解完成的。

@lmport可以导入如下三种类:

  • 普通的配置类
  • 实现lmportSelector接口的类
public class MyImportSelector implements ImportSelector {
    @Override
    public String[] selectImports(AnnotationMetadata importingClassMetadata) {
        //参数importingClassMetadata叫做注解媒体数组,该对象内部封装是当前使用了@import注解的类上的其他注解
        Map<String, Object> annotationAttributes = importingClassMetadata.getAnnotationAttributes(ComponentScan.class.getName());
        annotationAttributes.forEach((attrName,attrValue)->{
            System.out.println(attrName+"=="+attrValue);
        });
        //返回的数组是需要被注册到Spring容器中的Bean的全限定名
        return new String[]{otherBean2.class.getName(), otherBean.class.getName()};
    }
}
@Configuration
//<context:component-scan base-package="com.Smulll"/>
@ComponentScan(basePackages = {"com.Smulll"})//扫描包
//<context:property-placeholder location="classpath:jdbc.properties"/>
@PropertySource({"classpath:jdbc.properties"})
//<import resource=""/>
//@Import(otherBean.class)

//只能留一个@Import
@Import(MyImportSelector.class)

//Mapper接口扫描
@MapperScan("com.Smulll.mapper")
public class SpringConfig {    
}
 @Test
 public void exp3(){
     AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
     Object otherBean2 = annotationConfigApplicationContext.getBean(com.Smulll.Bean.otherBean2.class);
     System.out.println(otherBean2);
 }

运行结果
在这里插入图片描述

  • 实现lmportBeanDefinitionRegistrar接口的类
public class MyImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry, BeanNameGenerator importBeanNameGenerator) {
        //注册BeanDefinition
        RootBeanDefinition rootBeanDefinition = new RootBeanDefinition();
        rootBeanDefinition.setBeanClassName(otherBean2.class.getName());
        registry.registerBeanDefinition("otherBean2",rootBeanDefinition);
    }
}
@Configuration
//<context:component-scan base-package="com.Smulll"/>
@ComponentScan(basePackages = {"com.Smulll"})//扫描包
//<context:property-placeholder location="classpath:jdbc.properties"/>
@PropertySource({"classpath:jdbc.properties"})
//<import resource=""/>
//@Import(otherBean.class)
//@Import(MyImportSelector.class)
@Import(MyImportBeanDefinitionRegistrar.class)
//Mapper接口扫描
@MapperScan("com.Smulll.mapper")

public class SpringConfig {}
@Test
public void exp4(){
    AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
    Object otherBean2 = annotationConfigApplicationContext.getBean("otherBean2");
    System.out.println(otherBean2);
}

运行结果
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/842687.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

解决Vue+Element UI使用表单rules国际化时From表单验证信息不能实时更新

说明&#xff1a;该篇博客是博主一字一码编写的&#xff0c;实属不易&#xff0c;请尊重原创&#xff0c;谢谢大家&#xff01; 博主在工作之余开始进行自动化测试平台的开发&#xff0c;虽然已经996一个月了但是还是在使劲挤时间做这件事情&#xff0c;目前平台使用前端框架vu…

mysql再docker中运行,直接在实体机上运行mysql命令初始化数据库数据

背景 项目上我们使用docker安装mysql&#xff0c;项目启动的时候需要利用sql语句初始化数据。 直接在实体上是识别不到mysql命令的。 实现方式 实现方式1&#xff1a;在docker容器内部执行sql语句 1. 将sql文件上传到容器内 docker cp /root/1.sql d5:/home/ 说明&#…

日期格式化的最佳实践:如何在Java中处理日期格式化

文章目录 前言一、使用format()方法二、使用注解JsonFormat三、使用消息转换器1.定义用户类2.重写DateSerializer 方法3.定义对象映射器&#xff1a;4.定义消息转换器5.调用测试 总结 前言 当涉及到日期格式化时&#xff0c;了解正确的方式和最佳实践是至关重要的。 日期格式化…

Stephen Wolfram:ChatGPT 的训练

The Training of ChatGPT ChatGPT 的训练 OK, so we’ve now given an outline of how ChatGPT works once it’s set up. But how did it get set up? How were all those 175 billion weights in its neural net determined? Basically they’re the result of very large…

目标检测与跟踪 (3)- TensorRTYOLO V8性能优化与部署测试

系列文章目录 目标检测与跟踪 &#xff08;1&#xff09;- 机器人视觉与YOLO V8_Techblog of HaoWANG的博客-CSDN博客 目标检测与跟踪 &#xff08;2&#xff09;- YOLO V8配置与测试_Techblog of HaoWANG的博客-CSDN博客 目录 系列文章目录 前言 YOLO v8 TensorRT 一、…

等保三级中“身份鉴别”要求与2FA双因子认证有何关联?

为了保护信息的安全&#xff0c;我国实行对信息及信息载体按照重要性等级分别进行保护&#xff0c;也就是信息安全等级保护制度。根据信息系统在国家安全、经济建设、社会生活中的重要程度&#xff0c;信息系统遭到破坏后对国家安全、社会秩序、公共利益以及公民、法人和其他组…

c++(类型转换+IO)[30]

类型转换 意义相近的类型------隐式类型转换 意义不想近的类型&#xff0c;值转换后有意义------显示的强制类型转换 static_cast 任何隐式类型的转换&#xff0c;非多态类型的转换&#xff08;静态转换&#xff09;&#xff0c;意义相近的转换。 用于常见的隐式类型转换&am…

Spring Boot数据访问基础知识与JDBC简单实现

目录 Spring Boot数据访问基础知识 Spring Data ORM JDBC JPA JDBC简单实现 步骤1&#xff1a;新建Maven项目&#xff0c;添加依赖 步骤2&#xff1a;配置数据源—让程序可以访问到 步骤3&#xff1a;配置数据源—让IDEA可以访问到 步骤4&#xff1a;添加数据库和表 …

今天面了一个来字节要求月薪24K,明显感觉他背了很多面试题...

最近有朋友去字节面试&#xff0c;面试前后进行了20天左右&#xff0c;包含4轮电话面试、1轮笔试、1轮主管视频面试、1轮hr视频面试。 据他所说&#xff0c;80%的人都会栽在第一轮面试&#xff0c;要不是他面试前做足准备&#xff0c;估计都坚持不完后面几轮面试。 其实&…

4.DNS和负载均衡

文章目录 coreDNS概念部署croeDNS测试 kubernetes多master集群结构master节点部署 负载均衡配置部署nginx做四层反向代理安装高可用 keepalivednginx监控脚本修改k8s中组件的配置文件 coreDNS 概念 coreDNS是kubernetes的默认DNS实现。可以为集群中的service资源创建一个资源名…

ThinkPHP6企业OA办公系统

有需要请加文章底部Q哦 可远程调试 ThinkPHP6企业OA办公系统 一 介绍 勾股OA基于ThinkPHP6开发&#xff0c;前端Layui&#xff0c;数据库mysql&#xff0c;是一款实用的企业办公系统。可多角色登录&#xff0c;集成了系统设置、人事管理、消息管理、审批管理、日常办公、客户…

构建器/建造者/构建者模式(C++)

定义 将一个复杂对象的构建与其表示相分离,使得同样的构建过程(稳定)可以创建不同的表示(变化)。 应用场景 在软件系统中&#xff0c;有时候面临着“一个复杂对象”的创建工作&#xff0c;其通常由各个部分的子对象用一定的算法构成;由于需求的变化&#xff0c;这个复杂对象…

Homer:一个简单的静态主页

什么是 Homer ? Homer 是一个完全静态的 html/js 仪表板&#xff0c;基于一个简单的 yaml 配置文件。它旨在由 HTTP 服务器提供服务&#xff0c;如果您直接通过 file:// 协议打开 index.html&#xff0c;它将无法工作。 安装 在群晖上以 Docker 方式安装。 在注册表中搜索 h…

RISC-V基础之函数调用(四)非叶函数调用(包含实例)

叶函数是指不调用其他函数&#xff0c;也不改变任何非易失性寄存器的函数2。叶函数通常是一些简单的操作&#xff0c;如数学运算或逻辑判断。叶函数的特点是可以通过模拟返回来展开&#xff0c;即不需要保存或恢复寄存器的状态。 非叶函数是指调用其他函数或改变非易失性寄存器…

百度智能云“千帆大模型平台”升级:大模型最多,Prompt模板最全

&#x1f935;‍♂️ 个人主页&#xff1a;艾派森的个人主页 ✍&#x1f3fb;作者简介&#xff1a;Python学习者 &#x1f40b; 希望大家多多支持&#xff0c;我们一起进步&#xff01;&#x1f604; 如果文章对你有帮助的话&#xff0c; 欢迎评论 &#x1f4ac;点赞&#x1f4…

Rust 原生支持龙架构指令集

导读近日&#xff0c;Rust 开源社区发布 1.71.0 版本&#xff0c;实现对龙架构&#xff08;LoongArch&#xff09;指令集的原生支持。 龙架构操作系统发行版和开发者可基于上游社区源代码构建或直接下载 Rust 开源社区发布的龙架构二进制版本。Rust 开发者将在龙架构平台上获得…

【Vue】Parsing error: No Babel config file detected for ... vue

报错 Parsing error: No Babel config file detected for E:\Study\Vue网站\实现防篡改的水印\demo02\src\App.vue. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.             …

23年电赛D题-信号调制方式识别与参数估计装置

红叶何时落水 题目 题目分析 该题目的是制作一个信号检测以及解调装置 主要的任务有三个 1.六种信号的识别 2.信号相关参数的测量 3.信号解调 任务一 识别信号有很多思路&#xff0c;最简单的方式便是通过对信号进行FFT分析&#xff0c;分析其中的各个谐波的特征值。 …

自动化测试CSS元素定位

目录 1.1 CSS定位 1.1.1 绝对路径定位 1.1.2 相对路径定位 1.1.3 类名定位 1.1.4 属性定位 1.1.4.1 ID属性定位 1.1.4.2 其他属性定位 1.1.4.3 模糊属性定位 1.1.5 子页面元素查找 1.1.6 伪类定位 1.1 CSS伪类 1.1 CSS定位 1.1.1 绝对路径定位 目标 查找第一个文…

CS 144 Lab Seven -- putting it all together

CS 144 Lab Seven -- putting it all together 引言测试lab7.ccUDPSocketNetworkInterfaceAdapterTCPSocketLab7main方法子线程 小结 对应课程视频: 【计算机网络】 斯坦福大学CS144课程 Lab Six 对应的PDF: Checkpoint 6: putting it all together 引言 本实验无需进行任何编…