-
Notifications
You must be signed in to change notification settings - Fork 24
[김민준] sprint7 #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
adjoon1
wants to merge
1
commit into
codeit-bootcamp-spring:김민준
Choose a base branch
from
adjoon1:김민준sprint7
base: 김민준
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
The head ref may contain hidden characters: "\uAE40\uBBFC\uC900sprint7"
Open
[김민준] sprint7 #209
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
plugins { | ||
id 'java' | ||
id 'org.springframework.boot' | ||
id 'io.spring.dependency-management' | ||
} | ||
|
||
group = 'com.sprint.mission' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { url 'https://repo.spring.io/release' } // ✅ 추가 필요 | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
implementation 'de.codecentric:spring-boot-admin-starter-server:3.2.5' | ||
|
||
compileOnly 'org.projectlombok:lombok' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
|
||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
} |
14 changes: 14 additions & 0 deletions
14
admin/src/main/java/com/sprint/mission/admin/AdminApplication.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.sprint.mission.admin; | ||
|
||
import de.codecentric.boot.admin.server.config.EnableAdminServer; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
@EnableAdminServer | ||
public class AdminApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(AdminApplication.class, args); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
spring: | ||
application: | ||
name: admin | ||
server: | ||
port: 9090 |
12 changes: 12 additions & 0 deletions
12
admin/src/test/java/com/sprint/mission/admin/AdminApplicationTests.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.sprint.mission.admin; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
@SpringBootTest | ||
class AdminApplicationTests { | ||
|
||
@Test | ||
void contextLoads() { | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,44 @@ | ||
buildscript { | ||
ext { | ||
springBootVersion = '3.4.0' | ||
springDependencyVersion = '1.1.6' | ||
mapstructVersion = '1.6.3' | ||
springdocVersion = '2.8.4' | ||
} | ||
} | ||
|
||
plugins { | ||
id 'java' | ||
id 'org.springframework.boot' version '3.4.0' | ||
id 'io.spring.dependency-management' version '1.1.6' | ||
id 'java' // 기본 선언 | ||
id 'org.springframework.boot' version "${springBootVersion}" apply false | ||
id 'io.spring.dependency-management' version "${springDependencyVersion}" apply false | ||
} | ||
|
||
group = 'com.sprint.mission' | ||
version = '0.0.1-SNAPSHOT' | ||
allprojects { | ||
group = 'com.sprint.mission' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
repositories { | ||
mavenCentral() | ||
} | ||
} | ||
|
||
configurations { | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
subprojects { | ||
apply plugin: 'java' | ||
apply plugin: 'io.spring.dependency-management' | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
configurations { | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.4' | ||
compileOnly 'org.projectlombok:lombok' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher' | ||
implementation 'org.springframework.boot:spring-boot-starter-validation' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 빌드가 안됩니다 ㅠㅠ,, implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.4'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher' |
||
} | ||
|
||
tasks.named('test') { | ||
useJUnitPlatform() | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
rootProject.name = 'discodeit' | ||
|
||
rootProject.name = '3-sprint-mission' | ||
include 'admin' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/com/sprint/mission/discodeit/aop/LoggingAspect.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Slf4j | ||
@Aspect | ||
@Component | ||
public class LoggingAspect { | ||
|
||
@Around("execution(* com.sprint.mission.discodeit.controller..*(..)) || execution(* com.sprint.mission.discodeit.service..*(..))") | ||
public Object logExecution(ProceedingJoinPoint joinPoint) throws Throwable { | ||
String methodName = joinPoint.getSignature().toShortString(); | ||
log.info("▶️ Start: {}", methodName); | ||
Object result = joinPoint.proceed(); | ||
log.info("✅ End: {}", methodName); | ||
return result; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/sprint/mission/discodeit/config/AppConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.sprint.mission.discodeit.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
|
||
@Configuration | ||
@EnableJpaAuditing | ||
public class AppConfig { | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/sprint/mission/discodeit/config/JpaAuditingConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
@EnableJpaAuditing | ||
public class JpaAuditingConfig {} |
25 changes: 0 additions & 25 deletions
25
src/main/java/com/sprint/mission/discodeit/config/SwaggerConfig.java
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
src/main/java/com/sprint/mission/discodeit/config/WebMvcConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
@Configuration | ||
public class WebMvcConfig implements WebMvcConfigurer { | ||
|
||
private final MDCLoggingInterceptor mdcLoggingInterceptor; | ||
|
||
public WebMvcConfig(MDCLoggingInterceptor mdcLoggingInterceptor) { | ||
this.mdcLoggingInterceptor = mdcLoggingInterceptor; | ||
} | ||
|
||
@Override | ||
public void addInterceptors(InterceptorRegistry registry) { | ||
registry.addInterceptor(mdcLoggingInterceptor); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 22 additions & 9 deletions
31
src/main/java/com/sprint/mission/discodeit/controller/BinaryContentController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,50 @@ | ||
package com.sprint.mission.discodeit.controller; | ||
|
||
import com.sprint.mission.discodeit.controller.api.BinaryContentApi; | ||
import com.sprint.mission.discodeit.entity.BinaryContent; | ||
import com.sprint.mission.discodeit.dto.data.BinaryContentDto; | ||
import com.sprint.mission.discodeit.service.BinaryContentService; | ||
import com.sprint.mission.discodeit.storage.BinaryContentStorage; | ||
import java.util.List; | ||
import java.util.UUID; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RequiredArgsConstructor | ||
@RestController | ||
@RequestMapping("/api/binaryContents") | ||
public class BinaryContentController implements BinaryContentApi { | ||
|
||
private final BinaryContentService binaryContentService; | ||
private final BinaryContentStorage binaryContentStorage; | ||
|
||
@GetMapping(path = "{binaryContentId}") | ||
public ResponseEntity<BinaryContent> find(@PathVariable("binaryContentId") UUID binaryContentId) { | ||
BinaryContent binaryContent = binaryContentService.find(binaryContentId); | ||
public ResponseEntity<BinaryContentDto> find( | ||
@PathVariable("binaryContentId") UUID binaryContentId) { | ||
BinaryContentDto binaryContent = binaryContentService.find(binaryContentId); | ||
return ResponseEntity | ||
.status(HttpStatus.OK) | ||
.body(binaryContent); | ||
} | ||
|
||
@GetMapping | ||
public ResponseEntity<List<BinaryContent>> findAllByIdIn( | ||
public ResponseEntity<List<BinaryContentDto>> findAllByIdIn( | ||
@RequestParam("binaryContentIds") List<UUID> binaryContentIds) { | ||
List<BinaryContent> binaryContents = binaryContentService.findAllByIdIn(binaryContentIds); | ||
List<BinaryContentDto> binaryContents = binaryContentService.findAllByIdIn(binaryContentIds); | ||
return ResponseEntity | ||
.status(HttpStatus.OK) | ||
.body(binaryContents); | ||
} | ||
|
||
@GetMapping(path = "{binaryContentId}/download") | ||
public ResponseEntity<?> download( | ||
@PathVariable("binaryContentId") UUID binaryContentId) { | ||
BinaryContentDto binaryContentDto = binaryContentService.find(binaryContentId); | ||
return binaryContentStorage.download(binaryContentDto); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.2.5 버전은, 존재 안하는 버전입니다!
아래 링크 참조하여 주세요!
https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-starter-server