[스프링부트] 1. 컨트롤러 알아보기

metacoding's avatar
Nov 11, 2024
[스프링부트] 1. 컨트롤러 알아보기

1. 소스코드

App.java
package ex09; import ex09.pub.Publisher; import ex09.sub.Sub1; import ex09.sub.Sub2; // 옵저버 패턴 (콜백) public class App { public static void main(String[] args) { Publisher publisher = new Publisher(); Sub1 sub1 = new Sub1(); Sub2 sub2 = new Sub2(); new Thread(() -> { publisher.change("상품 들어왔어요"); }).start(); while (true) { try { Thread.sleep(1000); System.out.println("상품 들어왔어?"); } catch (Exception e) { // TODO: handle exception } if (publisher.getValue() != null) { sub1.update(publisher.getValue() + "들어왔어요"); sub2.update(publisher.getValue() + "들어왔어요"); break; } else { System.out.println("상품 아직 이야"); } } } }
 

2. 정리

  • 정리1
  • 정리2
    • 내부1
    • 내부2
 

3. 결과

러ㅏㅇㄴ모러ㅏㅗ마ㅓㄹㅇ놔ㅓ롸ㅓㄴ롸ㅓㄴㅁ
💡
샵샵은 헤딩2태그이다.
백틱3개는 소스코드이다.
하이픈 하나는 UL태그이다.
ㅎㅎㅎㅎㅎㅎㅎㅎㅎㅎㅎㅎ
notion image
Share article

metacoding