02 2023 档案
摘要:1、Spring4、SpringBoot1 1.1 代码实现 public interface Calculator { int div(int a,int b); } @Component public class CalculatorImpl implements Calculator{ @Ov
阅读全文
摘要:1、引入依赖 <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>5.9.1</version> </dependency> <dependency
阅读全文
摘要:1、引入依赖 <!--spring aop依赖--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>6.0.2</version> </dependen
阅读全文
摘要:1、定义接口 public interface Calculator { int add(int a,int b); int sub(int a,int b); int mul(int a,int b); int div(int a,int b); } 2、实现接口 public class Cal
阅读全文
摘要:1、定义IOC容器接口 public interface ApplicationContext { public Object getBean(Class clazz); } 2、实现IOC接口 public class AnnotationApplicationContext implements
阅读全文
摘要:1、类名.class Class clazz1 = User.class; 2、对象.getClass() Class clazz2 = new User().getClass(); 3、class.forName() Class clazz3 = Class.forName("com.jixian
阅读全文
摘要:首选 备用 百度 180.76.76.76 124.251.124.251 114 114.114.114.114 114.114.115.115 腾讯 119.29.29.29 182.254.116.116 阿里云 223.5.5.5 223.6.6.6 谷歌 8.8.8.8 8.8.4.4 O
阅读全文
摘要:1、用配置类代替配置文件 @Configuration @ComponentScan("com.jixian") public class SpringConfig { } 原来的配置文件bean.xml <?xml version="1.0" encoding="UTF-8"?> <beans x
阅读全文
摘要:1、根据名称注入 @Resource(name = "userService") private UserService userService; @Service("userService") public class UserServiceImpl implements UserService
阅读全文
摘要:1、根据类型找到对象注入 @Autowired private UserService userService; 2、set方法注入 private UserService userService; @Autowired public void setUserService(UserService
阅读全文
摘要:1、bean对象 private String name; public String getName() { return name; } public void setName(String name) { System.out.println("2、setname..."); this.nam
阅读全文
摘要:1. 基于set方法注入 <bean class="com.jixian.spring.entity.Book"> <property name="bname" value="计算机百科全书"/> <property name="author" value="jixian"/> </bean> 2.
阅读全文
摘要:1.根据id获取bean User user = (User)applicationContext.getBean("user"); 2.根据类型获取bean User user = applicationContext.getBean(User.class); 3.根据id和类型获取bean Us
阅读全文
摘要:1.引入依赖 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>6.0.5</version> </dependency> <dependency>
阅读全文
摘要:程序设计语言的构成 语言的种类千差万别,但是,一般来说,基本成分不外四种: 1. 数据成分,用以描述程序中所涉及的数据; 2. 运算成分,用以描述程序中所包含的运算; 3. 控制成分,用以表达程序中控制构造; 4. 传输成分,用以表达程序中数据的传输;
阅读全文
摘要:class HeapSort{ void headAdjust(int[] a,int k,int len){ a[0] = a[k];//暂存子树的根节点 for (int i = 2*k; i <= len ; i*=2) {//沿关键字较大的子节点向下筛选 if (i < len && a[i
阅读全文
摘要:class SelectSort{ public void sort(int[] a){ for (int i = 0; i < a.length - 1; i++) {//一共进行n-1趟 int min = i;//记录最小元素位置 for (int j = i+1; j < a.length;
阅读全文
摘要:class QuickSort{ int partition(int[] a,int low,int high){ int pivot = a[low]; //第一个元素作为枢轴 while (low < high){ //用low、high搜索枢轴的位置 while (low < high &&
阅读全文
摘要:1、算法思想 从后往前依次对比相邻两个元素的次序,如果这两个元素逆序就交换这两个元素的位置,每一趟把最小的元素冒到最前面,如果中间某趟没有发生交换,就说明整体有序。 2、算法实现 //冒泡排序 class BubbleSort{ public void sort(int[] a){ for (int
阅读全文
摘要://希尔排序 class ShellSort{ public void sort(int[] a){ int d,i,j,temp; for ( d = a.length/2; d >= 1; d=d/2) { for ( i = d; i <a.length ; i=i+d) { if (a[i]
阅读全文
摘要://插入排序 class InsertSort{ public void sort(int[] a){ int i,j,temp; for (i = 1; i < a.length; i++) { if (a[i] < a[i-1]){ temp = a[i]; for ( j = i-1; j >
阅读全文