0823 - 0829


# 0823 - 0829

# 0824 - @ConfigurationProperties

# @ConfigurationProperties

ConfigurationProperties๋Š” properties ํŒŒ์ผ์— ์„ค์ •ํ•œ property ๊ฐ’์„ ์ž๋ฐ” object์— ๋งคํ•‘ํ•˜์—ฌ ํ•ด๋‹น ๊ฐ’์„ ์‚ฌ์šฉํ•˜๊ธฐ ํŽธํ•˜๊ฒŒ ํ•ด์ค€๋‹ค.

@Data @ConfigurationProperties(prefix = "test.sample") public class TestSampleProperties { 
    private String testStr; 
    private int testInt; 
}
  • java class์˜ ๋ณ€์ˆ˜๋ช…์€ camel case
  • properties๋Š” -ํ•˜์ดํ”ˆ์„ ์‚ฌ์šฉํ•œ snake case
test.sample.test-str=ํ…Œ์ŠคํŠธ ๋ฌธ์ž์—ด ๊ฐ’ test.sample.test-int=1234
@Configuration
@EnableConfigurationProperties(TestSampleProperties.class)
@PropertySource("classpath:TestSample.properties")
public class TestSampleConfiguration {
    
}
  • @EnableConfigurationProperties ์„ ์–ธ์€ ํ•ด๋‹น Properties class๋กœ object๋ฅผ ์ƒ์„ฑ.
  • @PropertySource๋Š” properties ํŒŒ์ผ์„ ํ˜ธ์ถœ
    • ์—ฌ๋Ÿฌ๊ฐœ ์„ ์–ธ ๊ฐ€๋Šฅ prefix๋กœ ๊ตฌ๋ถ„
@Service public class TestSampleService { 
    @Autowired 
    private TestSampleProperties testSampleProperties; 
    
    public void test() { 
        String testStr = testSampleProperties.getTestStr(); // ํ•ด๋‹น ๊ฐ’์„ ์‚ฌ์šฉ 
    } 
}

# @Conditional*

# @ConditionalOnClass

@ConditionalOnClass({ EnableAspectJAutoProxy.class, Aspect.class, Advice.class, AnnotatedElement.class })
  • ํ•ด๋‹น ์„ค์ •๋œ class๊ฐ€ ์žˆ๋Š”์ง€ ์—ฌ๋ถ€๋ฅผ ํ™•์ธ. ์ฐธ์กฐ๋œ jar๊ฐ• ์žˆ๋Š”์ง€ ํŒŒ์•…
@ConditionalOnProperty(prefix = "spring.aop", name = "auto", havingValue = "true", matchIfMissing = true)
  • ์„ค์ •๋œ property๊ฐ’์ด ์žˆ๋Š”์ง€ ํ™•์ธ

# 0825 - git hub ์ธ์ฆ ๊ด€๋ จ ์ด์Šˆ

# ์†Œ์ŠคํŠธ๋ฆฌ ๊ณ„์ •์ •๋ณด ์ˆ˜๋™ ์‚ญ์ œ

  • ์†Œ์ŠคํŠธ๋ฆฌ๋ฅผ ์ด์šฉํ•  ์‹œ ๊ถŒํ•œ ์˜ค๋ฅ˜๋กœ ์‹คํŒจ
remote: HTTP Basic: Access denied fatal: Authentication failed for https://gitlab.com/{{project}}
  • ์„ค์ • ํŒŒ์ผ ์ œ๊ฑฐ
* Windows 
~\AppData\Local\Atlassian\SourceTree\userhost ~\AppData\Local\Atlassian\SourceTree\passwd 

* Mac OS 
~/Library/Application Support/SourceTree
  • hostusernamemap, {๊ณ„์ •}@STAuth-github.com ํŒŒ์ผ ์‚ญ์ œ

# ์†Œ์ŠคํŠธ๋ฆฌ ํ† ํฐ์œผ๋กœ ์ธ์ฆํ•˜๊ธฐ

8์›” 13์ผ ์ดํ›„ github ์ธ์ฆ ์ •์ฑ… ๋ณ€๊ฒฝ

Github
Settings
Developer settings
Personal access tokens
Generate new token
  • ํ† ํฐ ๋ฐœํ–‰
๊ณ„์ •์ถ”๊ฐ€
๊นƒํ—ˆ๋ธŒ ์„ ํƒ
๋ฒ ์ด์ง ์„ ํƒ
์‚ฌ์šฉ์ž ์ด๋ฆ„
์•”ํ˜ธ = Access token 
ํ”„๋กœํ† ์ฝœ SSH
  • ์†Œ์ŠคํŠธ๋ฆฌ ๊ณ„์ •์ถ”๊ฐ€

# 0826 - ์–ด๋…ธํ…Œ์ด์…˜

# ์–ด๋…ธํ…Œ์ด์…˜์ด๋ž€?

์–ด๋…ธํ…Œ์ด์…˜์ด๋ž€ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋ผ๊ณ  ๋ณผ ์ˆ˜ ์žˆ๋‹ค. ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰ ๊ด€์ ์—์„œ ๋ณด๋ฉด ํ”„๋กœ๊ทธ๋žจ์ด ์ฒ˜๋ฆฌํ•  ๋ฉ”์ธ ๋ฐ์ดํ„ฐ๊ฐ€ ์•„๋‹ˆ๋ผ ์‹คํ–‰๊ณผ์ •์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌํ•  ๊ฒƒ์ธ์ง€ ์•Œ๋ ค์ฃผ๋Š” ์„œ๋ธŒ๋ฐ์ดํ„ฐ๋ผ๊ณ  ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

# ์–ด๋…ธํ…Œ์ด์…˜์˜ ๊ธฐ๋Šฅ

  • ์ปดํŒŒ์ผ๋Ÿฌ์— ์ฝ”๋“œ ๋ฌธ๋ฒ• ์—๋Ÿฌ๋ฅผ ์ฒดํฌํ•˜๋„๋ก ์ •๋ณด ์ œ๊ณต

  • ๊ฐœ๋ฐœ ํˆด์—์„œ ๋นŒ๋“œ๋‚˜ ๋ฐฐ์น˜์‹œ ์ฝ”๋“œ๋ฅผ ์ž๋™์œผ๋กœ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ์ •๋ณด ์ œ๊ณต

  • ์‹คํ–‰ ์‹œ ํŠน์ • ๊ธฐ๋Šฅ์„ ์‹คํ–‰ํ•˜๋„๋ก ์ •๋ณด ์ œ๊ณต

  • ์‚ฌ์šฉ์ด์œ ?
    => ์ฝ”๋“œ์— ๋ถ€๊ฐ€์ ์ธ ์„ค๋ช…์˜ ์—ญํ• . ๋ฐ˜๋ณต์ ์œผ๋กœ ์ฒ˜๋ฆฌํ•ด์•ผํ•˜๋Š” ์ผ๋“ค์„ ์ž๋™ํ™”

# ์–ด๋…ธํ…Œ์ด์…˜ ์ •์˜

@Target({ElementType.[์ ์šฉ๋Œ€์ƒ]})
@Retention(RetentionPolicy.[์ •๋ณด์œ ์ง€๋˜๋Š” ๋Œ€์ƒ])
public @interface [์–ด๋…ธํ…Œ์ด์…˜๋ช…]{
	public ํƒ€์ž… elementName() [default ๊ฐ’]
    ...
}
  • @Target({ElementType.[์ ์šฉ๋Œ€์ƒ]}) : ์–ด๋– ํ•œ ๊ฐ’์— ์–ด๋…ธํ…Œ์ด์…˜์„ ์ ์šฉํ•  ๊ฒƒ์ธ์ง€

    • TYPE : ํด๋ž˜์Šค, ์ธํ„ฐํŽ˜์ด์Šค, ์—ด๊ฑฐ ํƒ€์ž…
    • ANNOTATION_TYPE : ์–ด๋…ธํ…Œ์ด์…˜
    • FIELD : ํ•„๋“œ
    • CONSTRUCTOR : ์ƒ์„ฑ์ž
    • METHOD : ๋ฉ”์†Œ๋“œ
    • LOCAL_VARIABLE : ๋กœ์ปฌ ๋ณ€์ˆ˜
    • PACKAGE : ํŒจํ‚ค์ง€
  • @Retention(RetentionPolicy.[์ •๋ณด์œ ์ง€๋˜๋Š” ๋Œ€์ƒ]) : ์–ด๋…ธํ…Œ์ด์…˜ ๊ฐ’๋“ค์€ ์–ธ์ œ๊นŒ์ง€ ์œ ์ง€ํ•  ๊ฒƒ์ธ์ง€ ๊ฐ’์„ ์ž…๋ ฅ. ๋Œ€๋ถ€๋ถ„ ์–ด๋…ธํ…Œ์ด์…˜์€ Runtime์‹œ์— ์‚ฌ์šฉ

    • SOURCE : ์†Œ์Šค์ƒ์—์„œ๋งŒ ์–ด๋…ธํ…Œ์ด์…˜ ์ •๋ณด๋ฅผ ์œ ์ง€ํ•œ๋‹ค. ์†Œ์Šค ์ฝ”๋“œ๋ฅผ ๋ถ„์„ํ• ๋•Œ๋งŒ ์˜๋ฏธ๊ฐ€ ์žˆ์œผ๋ฉฐ, ๋ฐ”์ดํŠธ ์ฝ”๋“œ ํŒŒ์ผ์—๋Š” ์ •๋ณด๊ฐ€ ๋‚จ์ง€ ์•Š๋Š”๋‹ค.
    • CLASS : ๋ฐ”์ดํŠธ ์ฝ”๋“œ ํŒŒ์ผ๊นŒ์ง€ ์–ด๋…ธํ…Œ์ด์…˜ ์ •๋ณด๋ฅผ ์œ ์ง€ํ•œ๋‹ค. ํ•˜์ง€๋งŒ ๋ฆฌํ”Œ๋ ‰์…˜์„ ์ด์šฉํ•ด์„œ ์–ด๋…ธํ…Œ์ด์…˜ ์ •๋ณด๋ฅผ ์–ป์„ ์ˆ˜๋Š” ์—†๋‹ค.
    • RUNTIME : ๋ฐ”์ดํŠธ ์ฝ”๋“œ ํŒŒ์ผ๊นŒ์ง€ ์–ด๋…ธํ…Œ์ด์…˜ ์ •๋ณด๋ฅผ ์œ ์ง€ํ•˜๋ฉด์„œ ๋ฆฌํ”Œ๋ ‰์…˜์„ ์ด์šฉํ•ด์„œ ๋Ÿฐํƒ€์ž„์— ์–ด๋…ธํ…Œ์ด์…˜ ์ •๋ณด๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ๋‹ค.

# 0827 - HTTP Live Streaming (HLS)

# HLS๋ž€?

HTTP ๊ธฐ๋ฐ˜ ์ ์‘ ๋น„ํŠธ๋ ˆ์ดํŠธ ์ŠคํŠธ๋ฆฌ๋ฐ ํ†ต์‹  ํ”„๋กœํ† ์ฝœ.
์ŠคํŠธ๋ฆฌ๋ฐ ๋ฐ์ดํ„ฐ๋ฅผ MPEG-2 Transport Stream์— ๋‹ด์•„ ์‹œ๊ฐ„ ๋‹จ์œ„๋กœ ์ž˜๊ฒŒ ์ชผ๊ฐœ์„œ ์ „์†กํ•œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์–ด๋–ค ํŒŒ์ผ์„ ์žฌ์ƒํ•ด์•ผ ํ•˜๋Š” ์ง€์— ๋Œ€ํ•œ ์ •๋ณด๋Š” m3u8 ํŒŒ์ผ์„ ์ด์šฉํ•˜์—ฌ ํ”Œ๋ ˆ์ด์–ด์— ์ „๋‹ฌํ•œ๋‹ค.

# ํŠน์ง•

  • HTTP๋ฅผ ์ „์†ก ์ฑ„๋„๋กœ ์‚ฌ์šฉ. HTTP๋Š” ์–‘๋ฐฉ ๋ฐฉ์‹์ด ์•„๋‹ˆ๊ธฐ ๋•Œ๋ฌธ์— ๋ผ์ด๋ธŒ ์ŠคํŠธ๋ฆฌ๋ฐ์„ ์œ„ํ•ด์„œ๋Š” ๋‹จ์ ์„ ๊ทน๋ณตํ•  ๋ณ„๋„์˜ ๋ฐฉ์‹์ด ํ•„์š”ํ•˜์ง€๋งŒ, ๋ฐฉํ™”๋ฒฝ์—์„œ HTTP ์„œ๋ฒ„๋กœ์˜ ์š”์ฒญ๋งŒ ํ†ต๊ณผ์‹œํ‚ค๊ธฐ๋ฉด ๋˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐฉํ™”๋ฒฝ์˜ ์„ค์ •์ด ๋‹จ์ˆœ.
  • ์š”์ฒญ๊ณผ ์‘๋‹ต์ด 1:1๋กœ ๋Œ€์‘๋˜๋ฏ€๋กœ NAT ํ™˜๊ฒฝ์—์„œ๋„ ์„œ๋ฒ„์™€ ๋™์‹ ํ•˜๋Š”๊ฒƒ์ด ์‰ฝ๋‹ค.
  • ์›น ์„œ๋น„์Šค๋ฅผ ์œ„ํ•œ ์บ์‹œ ๊ตฌ์กฐ๋ฅผ ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ณ , ๊ธฐ์กด์— ๊ตฌ์ถ•๋˜์–ด ์žˆ๋Š” CDN(Content Delivery Network)๋„ ํŠน๋ณ„ํžˆ ๋ณ€๊ฒฝํ•˜์ง€ ์•Š๊ณ  ๊ทธ๋Œ€๋กœ ์ด์šฉ.

# 0829 - ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ๋กœ๋“œ๋งต

# ๋ฐฑ์•ค๋“œ ๊ฐœ๋ฐœ์ž ๋กœ๋“œ๋งต(ํ˜„์žฌ ์‹œ์  ํŒŒ์•…ํ•˜๊ธฐ)

ํ•™์Šต๊ณผ ์ ์šฉ, ์‘์šฉ์— ๋Œ€ํ•œ ํƒœ๋„ -> 
ํด๋ฆฐ ์ฝ”๋“œ, ์ข‹์€ ์„ค๊ณ„๋ฅผ ์ด๋„๋Š” ๋‹จ์œ„ ํ…Œ์ŠคํŠธ -> 
์›น ๊ธฐ์ˆ ๊ณผ ์›น ํ”„๋กœ๊ทธ๋ž˜๋ฐ -> 
์Šคํ”„๋ง ํ”„๋ ˆ์ž„์›Œํฌ -> 
๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค -> 
ORM ํ”„๋ ˆ์ž„์›Œํฌ -> 
โ€ฆ -> 
CI/CD๋ฅผ ์œ„ํ•œ ์ธํ”„๋ผ์ŠคํŠธ๋Ÿญ์ฒ˜ -> 
ํด๋ฆฐ ์•„ํ‚คํ…์ฒ˜ -> 
DDD -> 
๋ถ„์‚ฐ ์‹œ์Šคํ…œ -> 
์ธํ”„๋ผ์ŠคํŠธ๋Ÿญ์ฒ˜ -> 
MSA -> 
โ€ฆ
Last update: September 2, 2021 22:00
Contributors: jaesungahn91