Skip to content

Commit

Permalink
[Refactor/#385] 설정 파일 정리 (#386)
Browse files Browse the repository at this point in the history
* feat: api bootjar 테스크 설정 변경

* refactor: Enable 어노테이션 삭제

* feat: AsyncConfig 구현

* refactor: Security Config @configuration 어노테이션으로 수정

* refactor: LocalDateTime JsonFormat 제거
  • Loading branch information
belljun3395 authored Sep 9, 2024
1 parent 59ce7fd commit e24b096
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
5 changes: 5 additions & 0 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@

import org.hidetake.gradle.swagger.generator.GenerateSwaggerUI
import org.springframework.boot.gradle.tasks.bundling.BootJar
import java.util.Random

tasks.withType(BootJar::class.java) {
loaderImplementation = org.springframework.boot.loader.tools.LoaderImplementation.CLASSIC
}

dependencies {
/** module */
implementation(project(":api-repo"))
Expand Down
4 changes: 0 additions & 4 deletions api/src/main/kotlin/com/few/api/config/ApiConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import org.springframework.boot.context.properties.ConfigurationPropertiesScan
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Import
import org.springframework.scheduling.annotation.EnableAsync
import org.springframework.web.servlet.config.annotation.EnableWebMvc

@Configuration
@ComponentScan(basePackages = [ApiConfig.BASE_PACKAGE])
Expand All @@ -21,8 +19,6 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc
ImageStorageConfig::class,
DocumentStorageConfig::class
)
@EnableWebMvc
@EnableAsync
@ConfigurationPropertiesScan(basePackages = [ApiConfig.BASE_PACKAGE])
class ApiConfig {
companion object {
Expand Down
8 changes: 8 additions & 0 deletions api/src/main/kotlin/com/few/api/config/AsyncConfig.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.few.api.config

import org.springframework.context.annotation.Configuration
import org.springframework.scheduling.annotation.EnableAsync

@Configuration
@EnableAsync
class AsyncConfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.few.api.security.filter.token.TokenAuthenticationFilter
import com.few.api.security.handler.DelegatedAccessDeniedHandler
import com.few.api.security.handler.DelegatedAuthenticationEntryPoint
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Profile
import org.springframework.http.HttpMethod
import org.springframework.security.authentication.ProviderManager
Expand All @@ -17,14 +18,13 @@ import org.springframework.security.config.http.SessionCreationPolicy
import org.springframework.security.web.SecurityFilterChain
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter
import org.springframework.security.web.util.matcher.AntPathRequestMatcher
import org.springframework.stereotype.Component
import org.springframework.web.cors.CorsConfiguration
import org.springframework.web.cors.CorsConfigurationSource
import org.springframework.web.cors.UrlBasedCorsConfigurationSource
import org.springframework.web.filter.OncePerRequestFilter

@EnableWebSecurity
@Component
@Configuration
class WebSecurityConfig(
private val authenticationEntryPoint: DelegatedAuthenticationEntryPoint,
private val accessDeniedHandler: DelegatedAccessDeniedHandler,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.few.api.web.controller.article.response

import com.fasterxml.jackson.annotation.JsonFormat
import java.net.URL
import java.time.LocalDateTime

Expand All @@ -12,7 +11,6 @@ data class ReadArticleResponse(
val content: String,
val problemIds: List<Long>,
val category: String,
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
val createdAt: LocalDateTime,
val views: Long,
val workbooks: List<WorkbookInfo> = emptyList(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.few.api.web.controller.workbook.article.response

import com.fasterxml.jackson.annotation.JsonFormat
import com.few.api.domain.workbook.article.dto.ReadWorkBookArticleOut
import com.few.api.web.controller.workbook.response.WriterInfo
import java.time.LocalDateTime
Expand All @@ -12,7 +11,6 @@ data class ReadWorkBookArticleResponse(
val content: String,
val problemIds: List<Long>,
val category: String,
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
val createdAt: LocalDateTime,
val day: Long,
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.few.api.web.controller.workbook.response

import com.fasterxml.jackson.annotation.JsonFormat
import java.net.URL
import java.time.LocalDateTime

Expand All @@ -14,7 +13,6 @@ data class BrowseWorkBookInfo(
val title: String,
val description: String,
val category: String,
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
val createdAt: LocalDateTime,
val writers: List<WriterInfo>,
val subscriberCount: Long,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.few.api.web.controller.workbook.response

import com.fasterxml.jackson.annotation.JsonFormat
import com.few.api.domain.workbook.usecase.dto.ReadWorkbookUseCaseOut
import java.net.URL
import java.time.LocalDateTime
Expand All @@ -11,7 +10,6 @@ data class ReadWorkBookResponse(
val title: String,
val description: String,
val category: String,
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
val createdAt: LocalDateTime,
val writers: List<WriterInfo>,
val articles: List<ArticleInfo>,
Expand Down

0 comments on commit e24b096

Please sign in to comment.