Skip to content

Commit

Permalink
Merge pull request #35 from team-REDDI/feat/#19/marketing-api
Browse files Browse the repository at this point in the history
feat: NoResourceFoundException 발생할 때 로그 안 뜨도록 수정
  • Loading branch information
itsme-shawn authored Jan 30, 2024
2 parents 1cdfc00 + 7375c9d commit d69ed93
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
9 changes: 9 additions & 0 deletions deploy_prod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
./gradlew bootJar

aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 533267191976.dkr.ecr.ap-northeast-2.amazonaws.com

docker build --platform amd64 -t reddi-server .

docker tag reddi-server:latest 533267191976.dkr.ecr.ap-northeast-2.amazonaws.com/reddi-server:latest

docker push 533267191976.dkr.ecr.ap-northeast-2.amazonaws.com/reddi-server:latest
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.resource.NoResourceFoundException;

@Slf4j
@RestControllerAdvice
public class ApiExceptionHandler {
@ExceptionHandler(NoResourceFoundException.class)
public ResponseEntity<ApiResponse<?>> handleNoResourceFoundException(NoResourceFoundException exception) {
// NoResourceFoundException이 발생했을 때 아무런 처리도 하지 않음
return ResponseEntity.ok().build();
}

@ExceptionHandler(Exception.class)
public ResponseEntity<ApiResponse<?>> handleExceptions(Exception exception) {

log.error("Exception occurred:", exception); // 스택 트레이스 정보를 포함한 로깅

return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(ApiResponse.errorResponse(exception.getMessage()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.csrf(csrf -> csrf.disable())
.sessionManagement(sessionManagement ->
sessionManagement.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.httpBasic(httpBasic -> httpBasic.disable())
.formLogin(formLogin -> formLogin.disable())
// .httpBasic(httpBasic -> httpBasic.disable())
// .formLogin(formLogin -> formLogin.disable())
.authorizeHttpRequests((authorize) -> authorize
.requestMatchers("/static/**", "/resources/**", "/css/**", "/js/**", "/images/**", "/**", "/swagger-ui/**", "/v3/api-docs/**").permitAll()
.requestMatchers("/static/**", "/resources/**", "/css/**", "/js/**", "/images/**").authenticated()
.requestMatchers(HttpMethod.GET, "/**").permitAll()
.requestMatchers(HttpMethod.GET, "/swagger-ui/**").permitAll()
.requestMatchers(HttpMethod.GET, "/v3/api-docs/**").permitAll()
Expand Down

0 comments on commit d69ed93

Please sign in to comment.