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

【Spring基础3】- Spring的入门程序

目录

    • 3-1 Spring的下载
    • 3-2 Spring的 jar 包
    • 3-3 第一个 Spring程序
      • 第一步:添加spring context的依赖,pom.xml配置如下
      • 第二步:添加junit依赖
      • 第三步:定义bean:User
      • 第四步:编写spring的配置文件:beans.xml。该文件放在resource文件夹(类的根路径)下。
        • Spring bean 标签的两个重要属性
      • 第五步:编写测试程序
      • 第六步运行测试
    • 3-4 第一个Spring程序详细剖析
      • bean标签的id属性可以重复吗?
      • 底层是怎么创建对象的,是通过反射机制调用无参数构造方法吗?
      • 把创建好的对象存储到一个什么样的数据结构当中了呢?
      • Spring配置文件的名字必须叫做 beans.xml 吗?
      • 像这样的 beans.xml 文件可以有多个吗?
      • 在配置文件中配置的类必须是自定义的吗,可以使用JDK中的类吗,例如:java.util.Date?
      • getBean()方法调用时,如果指定的id不存在会怎样?
      • getBean()方法返回的类型是Object,如果访问子类的特有属性和方法时,还需要向下转型,有其它办法可以解决这个问题吗?
      • ClassPathXmlApplicationContext是从类路径中加载配置文件,如果没有在类路径当中,又应该如何加载配置文件呢?
      • ApplicationContext 的超级父接口 BeanFactory
      • Spring的 Bean 对象是调用 getBean 的时候创建的吗?
    • 3-5 Spring引入 Log4j


3-1 Spring的下载

官网地址:https://spring.io/

下载地址:https://repo.spring.io/ui/packages


3-2 Spring的 jar 包

打开libs目录,会看到很多jar包:

spring-core-5.3.9.jar:字节码(这个是支撑程序运行的jar包

spring-core-5.3.9-javadoc.jar:代码中的注释

spring-core-5.3.9-sources.jar:源码

我们来看一下spring框架都有哪些jar包:

JAR文件描述
spring-aop-5.3.9.jar这个jar 文件包含在应用中使用Spring 的AOP 特性时所需的类
spring-aspects-5.3.9.jar提供对AspectJ的支持,以便可以方便的将面向切面的功能集成进IDE中
spring-beans-5.3.9.jar这个jar 文件是所有应用都要用到的,它包含访问配置文件、创建和管理bean 以及进行Inversion ofControl / Dependency Injection(IoC/DI)操作相关的所有类。如果应用只需基本的IoC/DI 支持,引入spring-core.jar 及spring-beans.jar 文件就可以了。
spring-context-5.3.9.jar这个jar 文件为Spring 核心提供了大量扩展。可以找到使用Spring ApplicationContext特性时所需的全部类,JDNI 所需的全部类,instrumentation组件以及校验Validation 方面的相关类。
spring-context-indexer-5.3.9.jar虽然类路径扫描非常快,但是Spring内部存在大量的类,添加此依赖,可以通过在编译时创建候选对象的静态列表来提高大型应用程序的启动性能。
spring-context-support-5.3.9.jar用来提供Spring上下文的一些扩展模块,例如实现邮件服务、视图解析、缓存、定时任务调度等
spring-core-5.3.9.jarSpring 框架基本的核心工具类。Spring 其它组件要都要使用到这个包里的类,是其它组件的基本核心,当然你也可以在自己的应用系统中使用这些工具类。
spring-expression-5.3.9.jarSpring表达式语言。
spring-instrument-5.3.9.jarSpring3.0对服务器的代理接口。
spring-jcl-5.3.9.jarSpring的日志模块。JCL,全称为"Jakarta Commons Logging",也可称为"Apache Commons Logging"。
spring-jdbc-5.3.9.jarSpring对JDBC的支持。
spring-jms-5.3.9.jar这个jar包提供了对JMS 1.0.2/1.1的支持类。JMS是Java消息服务。属于JavaEE规范之一。
spring-messaging-5.3.9.jar为集成messaging api和消息协议提供支持
spring-orm-5.3.9.jarSpring集成ORM框架的支持,比如集成hibernate,mybatis等。
spring-oxm-5.3.9.jar为主流O/X Mapping组件提供了统一层抽象和封装,OXM是Object Xml Mapping。对象和XML之间的相互转换。
spring-r2dbc-5.3.9.jarReactive Relational Database Connectivity (关系型数据库的响应式连接) 的缩写。这个jar文件是Spring对r2dbc的支持。
spring-test-5.3.9.jar对Junit等测试框架的简单封装。
spring-tx-5.3.9.jar为JDBC、Hibernate、JDO、JPA、Beans等提供的一致的声明式和编程式事务管理支持。
spring-web-5.3.9.jarSpring集成MVC框架的支持,比如集成Struts等。
spring-webflux-5.3.9.jarWebFlux是 Spring5 添加的新模块,用于 web 的开发,功能和 SpringMVC 类似的,Webflux 使用当前一种比较流程响应式编程出现的框架。
spring-webmvc-5.3.9.jarSpringMVC框架的类库
spring-websocket-5.3.9.jarSpring集成WebSocket框架时使用

注意:

如果你只是想用Spring的IoC功能,仅需要引入:spring-context即可。将这个jar包添加到classpath当中。

如果采用maven只需要引入context的依赖即可。

<!--Spring6的正式版发布之前,这个仓库地址是需要的-->
<repositories><repository><id>repository.spring.milestone</id><name>Spring Milestone Repository</name><url>https://repo.spring.io/milestone</url></repository>
</repositories><dependencies><!--spring context依赖:使用的是6.0.0-M2里程碑版--><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>6.0.0-M2</version></dependency>
</dependencies>

3-3 第一个 Spring程序

前期准备

  • 打开IDEA创建Empty Project:spring6

  • 设置JDK版本17,编译器版本17

  • 设置IDEA的Maven:关联自己的maven

  • 在空的工程spring6中创建第一个模块:spring6-001-first

第一步:添加spring context的依赖,pom.xml配置如下

  • 当引入了 spring-context 依赖之后,表示引用了 Spring 的基础依赖

当加入spring context的依赖之后,会关联引入其他依赖:

  • spring aop:面向切面编程
  • spring beans:IoC核心
  • spring core:spring的核心工具包
  • spring jcl:spring的日志包
  • spring expression:spring表达式
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.powernode</groupId><artifactId>spring6-001-first</artifactId><version>1.0-SNAPSHOT</version><!--打包方式jar,学习Spring,项目可以不是web项目,普通的java项目即可。--><packaging>jar</packaging><!--配置多个仓库--><repositories><!--spring里程碑版本的仓库--><repository><id>repository.spring.milestone</id><name>Spring Milestone Repository</name><url>https://repo.spring.io/milestone</url></repository></repositories><dependencies><!--spring context依赖--><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>6.0.0-M2</version></dependency></dependencies><properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target></properties></project>

第二步:添加junit依赖

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.powernode</groupId><artifactId>spring6-001-first</artifactId><version>1.0-SNAPSHOT</version><packaging>jar</packaging><repositories><repository><id>repository.spring.milestone</id><name>Spring Milestone Repository</name><url>https://repo.spring.io/milestone</url></repository></repositories><dependencies><!--spring context依赖--><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>6.0.0-M2</version></dependency><!--junit--><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.13.2</version><scope>test</scope></dependency></dependencies><properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target></properties></project>

第三步:定义bean:User

  • 在当前项目中创建一个包,同时新建一个 User 类

这是一个Bean,封装了用户的信息。Spring可以帮助我们创建User对象吗?

  • 如果想让 Spring 帮我们管理 User 这个 bean 文件,我们需要写 xml 配置文件
package com.powernode.spring6.bean;/*** 这是一个Bean,封装了用户的信息。Spring可以帮助我们创建User对象吗?* @version 1.0* @className User* @since 1.0**/
public class User {// Spring是怎么实例化对象的?// 默认情况下Spring会通过反射机制,调用类的无参数构造方法来实例化对象。// 实现原理如下:// Class clazz = Class.forName("com.powernode.spring6.bean.User");// Object obj = clazz.newInstance();public User() {System.out.println("User的无参数构造方法执行。");}public User(String s){}
}

第四步:编写spring的配置文件:beans.xml。该文件放在resource文件夹(类的根路径)下。

上图是使用IDEA工具自带的spring配置文件的模板进行创建。

  • 配置文件中进行bean的配置。
    • IDEA工具为我们提供了这个文件的模板,一定要使用这个模板来创建
    • 这个文件名不一定叫做spring.xml,可以是其它名字
    • 这个文件最好是放在类路径当中,方便后期的移植
    • 放在resources根目录下,就相当于是放到了类的根路径下
    • 配置bean,这样spring才可以帮助我们管理这个对象
Spring bean 标签的两个重要属性

bean的id和class属性:

  • id属性:代表对象的唯一标识。可以看做一个人的身份证号。(不可以重复)
  • class属性:用来指定要创建的java对象的类名,这个类名必须是 全限定类名(带包名)。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"><bean id="userBean" class="com.powernode.spring6.bean.User"/>
</beans>

第五步:编写测试程序

  • 第一步: 获取 Spring 容器对象
  • 第二步:根据 bean 的 id 从 Spring 容器中获取对象
  • 第一步:获取Spring容器对象。
  • ApplicationContext 翻译为:应用上下文。其实就是Spring容器。
    • ApplicationContext 是一个接口。
    • ApplicationContext 接口下有很多实现类。其中有一个实现类叫做:ClassPathXmlApplicationContext
    • ClassPathXmlApplicationContext 专门从类路径当中加载spring配置文件的一个Spring上下文对象。
  • 这行代码只要执行:就相当于启动了Spring容器,解析spring.xml文件,并且实例化所有的bean对象,放到spring容器当中。
package com.powernode.spring6.test;import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class Spring6Test {@Testpublic void testFirst(){// 第一步:获取Spring容器对象。// ApplicationContext 翻译为:应用上下文。其实就是Spring容器。// ApplicationContext 是一个接口。// ApplicationContext 接口下有很多实现类。其中有一个实现类叫做:ClassPathXmlApplicationContext// ClassPathXmlApplicationContext 专门从类路径当中加载spring配置文件的一个Spring上下文对象。// 这行代码只要执行:就相当于启动了Spring容器,解析spring.xml文件,并且实例化所有的bean对象,放到spring容器当中。// ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring6.xml");// ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring6.xml", "beans.xml");ApplicationContext applicationContext = new ClassPathXmlApplicationContext("beans.xml");// 根据id获取bean对象Object userBean = applicationContext.getBean("userBean");System.out.println(userBean);}
}

第六步运行测试


3-4 第一个Spring程序详细剖析

bean标签的id属性可以重复吗?

  • 在spring的配置文件中id是不能重名。
package com.powernode.spring6.bean;/*** @author 动力节点* @version 1.0* @className Vip* @since 1.0**/
public class Vip {
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"><bean id="userBean" class="com.powernode.spring6.bean.User"/><bean id="userBean" class="com.powernode.spring6.bean.Vip"/>
</beans>

运行测试程序:

通过测试得出:在spring的配置文件中id是不能重名。


底层是怎么创建对象的,是通过反射机制调用无参数构造方法吗?

  • 默认情况下,Spring 会通过反射机制,调用类的无参构造方法来实例化对象
  • spring是通过调用类的无参数构造方法来创建对象的,所以要想让 spring 给你创建对象,必须保证无参数构造方法是存在的。

Spring是如何创建对象的呢?原理是什么?

实现原理代码:(通过反射返回一个实例对象)

// 反射机制,实现对对象的创建
Class clazz = Class.forName("com.powernode.spring6.bean.User");
Object obj = clazz.newInstance();

package com.powernode.spring6.bean;/*** bean,封装用户信息。* @version 1.0* @since 1.0*/
public class User {public User() {System.out.println("User的无参数构造方法执行");}
}

在User类中添加无参数构造方法,如上。

运行测试程序:

通过测试得知:创建对象时确实调用了无参数构造方法。

如果提供一个有参数构造方法,不提供无参数构造方法会怎样呢?

package com.powernode.spring6.bean;/*** bean,封装用户信息。* @author 动力节点* @version 1.0* @since 1.0*/
public class User {/*public User() {System.out.println("User的无参数构造方法执行");}*/public User(String name){System.out.println("User的有参数构造方法执行");}
}

运行测试程序:

通过测试得知:spring是通过调用类的无参数构造方法来创建对象的,所以要想让spring给你创建对象,必须保证无参数构造方法是存在的。


把创建好的对象存储到一个什么样的数据结构当中了呢?

  • 实际上对 bean 的管理存在一个 Map 集合中


Spring配置文件的名字必须叫做 beans.xml 吗?

ApplicationContext applicationContext = new ClassPathXmlApplicationContext("beans.xml");

通过以上的java代码可以看出,这个spring配置文件名字是我们负责提供的,显然spring配置文件的名字是随意的。


像这样的 beans.xml 文件可以有多个吗?

  • 通过测试得知,spring的配置文件可以有多个,在ClassPathXmlApplicationContext构造方法的参数上传递文件路径即可。

再创建一个spring配置文件,起名:spring.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"><bean id="vipBean" class="com.powernode.spring6.bean.Vip"/>
</beans>
package com.powernode.spring6.test;import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class Spring6Test {@Testpublic void testFirst(){// 初始化Spring容器上下文(解析beans.xml文件,创建所有的bean对象)ApplicationContext applicationContext = new ClassPathXmlApplicationContext("beans.xml","spring.xml");// 根据id获取bean对象Object userBean = applicationContext.getBean("userBean");Object vipBean = applicationContext.getBean("vipBean");System.out.println(userBean);System.out.println(vipBean);}
}

运行测试程序:

  • 通过测试得知,spring的配置文件可以有多个,在ClassPathXmlApplicationContext构造方法的参数上传递文件路径即可。这是为什么呢?通过源码可以看到:


在配置文件中配置的类必须是自定义的吗,可以使用JDK中的类吗,例如:java.util.Date?

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"><bean id="userBean" class="com.powernode.spring6.bean.User"/><!--<bean id="userBean" class="com.powernode.spring6.bean.Vip"/>--><bean id="dateBean" class="java.util.Date"/>
</beans>
package com.powernode.spring6.test;import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class Spring6Test {@Testpublic void testFirst(){// 初始化Spring容器上下文(解析beans.xml文件,创建所有的bean对象)ApplicationContext applicationContext = new ClassPathXmlApplicationContext("beans.xml","spring.xml");// 根据id获取bean对象Object userBean = applicationContext.getBean("userBean");Object vipBean = applicationContext.getBean("vipBean");Object dateBean = applicationContext.getBean("dateBean");System.out.println(userBean);System.out.println(vipBean);System.out.println(dateBean);}
}
  • 运行结果

通过测试得知,在spring配置文件中配置的bean可以任意类,只要这个类不是抽象的,并且提供了无参数构造方法。


getBean()方法调用时,如果指定的id不存在会怎样?

运行测试程序:

  • 通过测试得知,当id不存在的时候,会出现异常。

getBean()方法返回的类型是Object,如果访问子类的特有属性和方法时,还需要向下转型,有其它办法可以解决这个问题吗?

运行测试程序:

  • 不想强制类型转换,可以使用以下代码(通过第二个参数来指定返回的bean的类型。)
User user = applicationContext.getBean("userBean", User.class);//Object nowTime = applicationContext.getBean("nowTime");
//Date nowTime = (Date) applicationContext.getBean("nowTime");
// 不想强制类型转换,可以使用以下代码(通过第二个参数来指定返回的bean的类型。)
Date nowTime = applicationContext.getBean("nowTime", Date.class);

ClassPathXmlApplicationContext是从类路径中加载配置文件,如果没有在类路径当中,又应该如何加载配置文件呢?

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"><bean id="vipBean2" class="com.powernode.spring6.bean.Vip"/>
</beans>
ApplicationContext applicationContext2 = new FileSystemXmlApplicationContext("d:/spring6.xml");
Vip vip = applicationContext2.getBean("vipBean2", Vip.class);
System.out.println(vip);
  • 没有在类路径中的话,需要使用 FileSystemXmlApplicationContext 类进行加载配置文件。
  • 这种方式较少用。一般都是将配置文件放到类路径当中,这样可移植性更强。

ApplicationContext 的超级父接口 BeanFactory

BeanFactory beanFactory = new ClassPathXmlApplicationContext("spring.xml");
Object vipBean = beanFactory.getBean("vipBean");
System.out.println(vipBean);
  • BeanFactory 是 Spring 容器的超级接口。ApplicationContext 是 BeanFactory 的子接口。
  • Spring IoC 的实现,底层使用了工厂模式,底层原理是 : XML解析 + 工厂模式 + 反射机制

Spring的 Bean 对象是调用 getBean 的时候创建的吗?

  • 注意:不是在调用 getBean() 方法的时候创建对象,执行以下代码的时候,就会实例化对象。
// 注意:不是在调用getBean()方法的时候创建对象,执行以下代码的时候,就会实例化对象。
new ClassPathXmlApplicationContext("spring6.xml");

3-5 Spring引入 Log4j

从Spring5之后,Spring框架支持集成的日志框架是Log4j 如何启用日志框架:

  • 1- 第一步:引入Log4j2的依赖
<!--log4j2的依赖-->
<dependency><groupId>org.apache.logging.log4j</groupId><artifactId>log4j-core</artifactId><version>2.19.0</version>
</dependency>
<dependency><groupId>org.apache.logging.log4j</groupId><artifactId>log4j-slf4j2-impl</artifactId><version>2.19.0</version>
</dependency>
  • 2- 第二步:在类的根路径下提供log4j2.xml配置文件(文件名固定为:log4j2.xml,文件必须放到类根路径下。)
<?xml version="1.0" encoding="UTF-8"?><configuration><loggers><!--level指定日志级别,从低到高的优先级:ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < OFF--><root level="DEBUG"><appender-ref ref="spring6log"/></root></loggers><appenders><!--输出日志信息到控制台--><console name="spring6log" target="SYSTEM_OUT"><!--控制日志输出的格式--><PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss SSS} [%t] %-3level %logger{1024} - %msg%n"/></console></appenders></configuration>
  • 3- 第三步:使用日志框架
Logger logger = LoggerFactory.getLogger(FirstSpringTest.class);
logger.info("我是一条日志消息");

相关文章:

  • 【python进阶攻略13】协程、内存copy、多进程
  • AI大模型面试大纲
  • Flutter中使用FFI的方式链接C/C++的so库(harmonyos)
  • 万象奥科工业平板上线,邀您体验与众不同!
  • 聊一下数据脱敏
  • 【机器学习(五)】分类和回归任务-AdaBoost算法
  • webpack 4 的 30 个步骤构建 react 开发环境
  • .NET CORE程序发布IIS后报错误 500.19
  • 嵌入式必懂微控制器选型:STM32、ESP32、AVR与PIC的比较分析
  • 银河麒麟,apt 安装软件报错640Unknown Status
  • JUC高并发编程5:多线程锁
  • 滚雪球学Oracle[7.1讲]:Oracle云数据库
  • Android Studio | 无法识别Icons.Default.Spa中的Spa
  • 实用工具推荐---- PDF 转换
  • AtCoder ABC371 A-D题解
  • 【译】JS基础算法脚本:字符串结尾
  • [ 一起学React系列 -- 8 ] React中的文件上传
  • docker容器内的网络抓包
  • input实现文字超出省略号功能
  • MYSQL 的 IF 函数
  • MYSQL如何对数据进行自动化升级--以如果某数据表存在并且某字段不存在时则执行更新操作为例...
  • PHP面试之三:MySQL数据库
  • Spring技术内幕笔记(2):Spring MVC 与 Web
  • Vim 折腾记
  • 浮现式设计
  • 跨域
  • 模仿 Go Sort 排序接口实现的自定义排序
  • 前端_面试
  • 算法-插入排序
  • 微服务核心架构梳理
  • TPG领衔财团投资轻奢珠宝品牌APM Monaco
  • 资深实践篇 | 基于Kubernetes 1.61的Kubernetes Scheduler 调度详解 ...
  • ​​​​​​​Installing ROS on the Raspberry Pi
  • # 详解 JS 中的事件循环、宏/微任务、Primise对象、定时器函数,以及其在工作中的应用和注意事项
  • #考研#计算机文化知识1(局域网及网络互联)
  • #我与Java虚拟机的故事#连载19:等我技术变强了,我会去看你的 ​
  • (70min)字节暑假实习二面(已挂)
  • (echarts)echarts使用时重新加载数据之前的数据存留在图上的问题
  • (二) Windows 下 Sublime Text 3 安装离线插件 Anaconda
  • (二)springcloud实战之config配置中心
  • (分布式缓存)Redis分片集群
  • (附表设计)不是我吹!超级全面的权限系统设计方案面世了
  • (欧拉)openEuler系统添加网卡文件配置流程、(欧拉)openEuler系统手动配置ipv6地址流程、(欧拉)openEuler系统网络管理说明
  • (数据结构)顺序表的定义
  • *(长期更新)软考网络工程师学习笔记——Section 22 无线局域网
  • .net 7 上传文件踩坑
  • .net core 6 使用注解自动注入实例,无需构造注入 autowrite4net
  • .Net Core 中间件与过滤器
  • .net 发送邮件
  • .NET 中创建支持集合初始化器的类型
  • .NET/C# 编译期间能确定的相同字符串,在运行期间是相同的实例
  • .NET/C# 推荐一个我设计的缓存类型(适合缓存反射等耗性能的操作,附用法)
  • .net下简单快捷的数值高低位切换
  • .Net中wcf服务生成及调用
  • .w文件怎么转成html文件,使用pandoc进行Word与Markdown文件转化