<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.0">Jekyll</generator><link href="https://sehui-byte.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://sehui-byte.github.io/" rel="alternate" type="text/html" /><updated>2021-01-08T18:08:15+00:00</updated><id>https://sehui-byte.github.io/feed.xml</id><title type="html">Coffee and Coding</title><subtitle>📌깃허브 블로그</subtitle><author><name>SH</name><email>wintersnow3@naver.com</email></author><entry><title type="html">스프링 기초개념</title><link href="https://sehui-byte.github.io/spring/spring-basic/" rel="alternate" type="text/html" title="스프링 기초개념" /><published>2021-01-09T00:00:00+00:00</published><updated>2021-01-09T00:00:00+00:00</updated><id>https://sehui-byte.github.io/spring/spring-basic</id><content type="html" xml:base="https://sehui-byte.github.io/spring/spring-basic/">&lt;h1 id=&quot;spring이란&quot;&gt;Spring이란?&lt;/h1&gt;

&lt;h1&gt;&lt;Spring&gt;&lt;/Spring&gt;&lt;/h1&gt;

&lt;h2 id=&quot;스프링-프레임워크의-특징&quot;&gt;스프링 프레임워크의 특징&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;경량(Lightweight)&lt;/strong&gt; → &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POJO&lt;/code&gt;형태의 객체를 관리.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;IoC(Inversion of Control)&lt;/strong&gt; → 객체 생성과 관리를 &lt;strong&gt;컨테이너&lt;/strong&gt;가 담당.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;AOP(Aspect Oriented Programming) →&lt;/strong&gt; 높은 응집도&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;컨테이너(Container) →&lt;/strong&gt; 낮은 결합도&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;결합도coupling가-낮은-프로그램을-구현하기-위한-방법&quot;&gt;&lt;strong&gt;결합도(Coupling)가 낮은 프로그램을 구현하기 위한 방법&lt;/strong&gt;&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;다형성 → &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;인터페이스&lt;/code&gt;로 구현&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Factory&lt;/code&gt;디자인패턴 이용&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;결합도(Coupling)란?&lt;/strong&gt; 하나의 클래스가 다른 클래스와 얼마나 연결되어있는지 정도를 나타내는 표현.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;didependency-injection&quot;&gt;DI(Dependency Injection)&lt;/h2&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;B&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(){&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;붙박이형.&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt;객체를 생성하면 그 안에서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt;객체가 생성된다. 마치 완제품과 같다. → 부품을 바꿔 끼기가 어렵다. 새로 완제품을 사거나 내부를 까서 뜯어고쳐야 된다.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;B&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;B&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;){&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;조립형.&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt;객체가 생성될 때 직접 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt;객체를 생성하지 않고, 외부에서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setter()&lt;/code&gt;메소드를 이용하여 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt;객체를 조립(생성)한다. 즉 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt;객체에 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt;라는 부품을 끼워넣는 것과 같다.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;우측의 조립형과 같은 방식으로 코드를 짤 경우 &lt;strong&gt;결합도가 낮아진다.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;A&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;B&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//부품객체 -&amp;gt; dependency&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//부품을 꽂아넣는다 -&amp;gt;injection&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;왜 이러한 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;injection dependency&lt;/code&gt;를 사용하는가? →  &lt;strong&gt;내부코드를 수정하지 않고, 외부 코드를 통하여 내부 코드를 수정&lt;/strong&gt;할 수 있다는 장점이 있다. 즉 &lt;strong&gt;결합력이 낮아져 코드의 유지보수가 수월해진다&lt;/strong&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;장점 : 부품을 쉽게 바꿀 수 있다.&lt;/strong&gt; → 만약 B부품 대신 C부품을 사용하려면 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setter()&lt;/code&gt;를 이용하여 C부품을 꽂아넣으면 된다. 위 코드는 간단한 예제이므로 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setB()&lt;/code&gt;인데 어떻게 C부품을 꽂아넣어? 라고 생각할 수 있지만, &lt;strong&gt;인터페이스와 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Factory&lt;/code&gt; 패턴을 이용하여 보완&lt;/strong&gt;하면, 이런 방식으로 B부품을 C부품으로 대체할 수 있게 된다.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;단점 : 부품을 조립해야만한다.&lt;/strong&gt; → &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setter()&lt;/code&gt;를 누군가 해줘야 한다.
    &lt;ul&gt;
      &lt;li&gt;이런 setter()와 같은 작업들을 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;spring&lt;/code&gt;을 사용하면 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IoC컨테이너&lt;/code&gt;가 담당해준다.&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setter injection&lt;/code&gt;과 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;construction injection&lt;/code&gt;이 있다.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;ioc컨테이너&quot;&gt;IoC컨테이너&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;IoC : 제어의 역행&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xml&lt;/code&gt;파일과 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;annotation&lt;/code&gt;을 이용.&lt;/li&gt;
  &lt;li&gt;마치 주문서에 따라 부품을 생성하고 부품을 조립하여 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Container&lt;/code&gt;에 담는 것-이라고 이해할 수 있다.&lt;/li&gt;
  &lt;li&gt;즉 &lt;strong&gt;컨테이너가 개발자를 대신하여 객체의 생성과 객체들 사이의 의존관계를 처리&lt;/strong&gt;해준다.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/64109506/103795817-cae9e580-5089-11eb-91c0-cac99bf94b87.png&quot; alt=&quot;image&quot; /&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DI&lt;/code&gt;를 이용하여 &lt;strong&gt;객체를 직접 생성하지 않고(직접 생성시에 유지보수시 내부코드를 수정해야하는 일이 발생한다), 외부에서 객체(이해하기 쉽게 말하자면 ‘&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;부품&lt;/code&gt;‘)를 생성한 후 해당 객체를 주입하는 방식 → 프로그램 결합도를 낮춰 유지보수를 편리하게 할 수 있다.&lt;/strong&gt; 을 알아보았다.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/64109506/103798546-371a1880-508d-11eb-9e75-99b348189fc0.png&quot; alt=&quot;image&quot; /&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;스프링 프레임워크의 특징 중 하나인 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IoC컨테이너&lt;/code&gt;는 &lt;strong&gt;개발자를 대신하여 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot;주문서&quot;&lt;/code&gt;&lt;/strong&gt;(쉽게 이해하기 위해 사용하는 용어)(Tv: lg제품 &lt;strong&gt;이런식으로 설정해주는 파일)&lt;/strong&gt;에 따라 객체를 생성하고 조립하여 컨테이너에 담아준다**.&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;이 주문서는 어떤 객체(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;부품&lt;/code&gt;으로 이해하면 쉽다)를 사용할 건지 등의 내용이 들어간다.&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Bean&lt;/code&gt; : 스프링 컨테이너에 의해 생성되는 자바의 객체.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;스프링&lt;/code&gt;을 이용하여 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;주문서&lt;/code&gt;를 만들 때 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xml&lt;/code&gt;파일, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;annotaion&lt;/code&gt; 등의 방식으로 만들 수 있다.&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;참고자료&quot;&gt;참고자료&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;스프링 퀵 스타트&lt;/strong&gt; - 채규태&lt;/li&gt;
  &lt;li&gt;유튜브 - &lt;strong&gt;뉴렉쳐 spring 강좌&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://private.tistory.com/39&quot;&gt;이미지 출처&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;책과 유튜브 강좌를 보고 개인적으로 이해할 수 있도록 나만의 언어로 정리합니다.&lt;/p&gt;</content><author><name>SH</name><email>wintersnow3@naver.com</email></author><category term="spring" /><summary type="html">Spring이란?</summary></entry><entry><title type="html">(예시) 블로그 첫포스팅</title><link href="https://sehui-byte.github.io/%EA%B8%B0%ED%83%80/sample/" rel="alternate" type="text/html" title="(예시) 블로그 첫포스팅" /><published>2020-07-10T00:00:00+00:00</published><updated>2020-07-10T00:00:00+00:00</updated><id>https://sehui-byte.github.io/%EA%B8%B0%ED%83%80/sample</id><content type="html" xml:base="https://sehui-byte.github.io/%EA%B8%B0%ED%83%80/sample/">&lt;p&gt;깃허브 블로그를 만들었다.
예시로 첫 블로그 포스팅을 써본다.
넘 어렵다.&lt;/p&gt;</content><author><name>SH</name><email>wintersnow3@naver.com</email></author><category term="기타" /><summary type="html">깃허브 블로그를 만들었다. 예시로 첫 블로그 포스팅을 써본다. 넘 어렵다.</summary></entry></feed>