spring 完结

This commit is contained in:
法然
2022-10-14 23:39:59 +08:00
parent b91ab7307e
commit 24bc4f24fe
265 changed files with 7316 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
package com.ykl.shangguigu08;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Shangguigu08Application {
public static void main(String[] args) {
SpringApplication.run(Shangguigu08Application.class, args);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Alipay.com Inc.
* Copyright (c) 2004-2022 All Rights Reserved.
*/
package com.ykl.shangguigu08.reactor;
import java.util.Observable;
/**
* @author yinkanglong
* @version : ObserverDemo, v 0.1 2022-10-12 19:47 yinkanglong Exp $
*/
public class ObserverDemo extends Observable {
/**
* 通过Java8中的类实现响应式编程。
* 简单来说,就是观察值模式。
* @param args
*/
public static void main(String[] args) {
ObserverDemo observerDemo = new ObserverDemo();
observerDemo.addObserver((o,arg)->{
System.out.println("发生变化");
});
observerDemo.addObserver((o,arg)->{
System.out.println("准备改变");
});
observerDemo.setChanged();
observerDemo.notifyObservers();
}
}

View File

@@ -0,0 +1,36 @@
/**
* Alipay.com Inc.
* Copyright (c) 2004-2022 All Rights Reserved.
*/
package com.ykl.shangguigu08.reactor;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
/**
* @author yinkanglong
* @version : TestReactor, v 0.1 2022-10-13 10:25 yinkanglong Exp $
*/
public class TestReactor {
public static void main(String[] args) {
//reactor中的核心语法
Flux.just(1,2,3,4).subscribe(System.out::print);
Mono.just(1).subscribe(System.out::print);
//其他方法
// Integer[] array = {1,2,3,4};
// Flux.fromArray(array);
//
// List<Integer> list = Arrays.asList(array);
// Flux.fromIterable(list);
//
// Stream<Integer> stream = list.stream();
// Flux.fromStream(stream);
}
}

View File

@@ -0,0 +1,13 @@
package com.ykl.shangguigu08;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class Shangguigu08ApplicationTests {
@Test
void contextLoads() {
}
}