Skip to content

Commit

Permalink
swagger 추가 등
Browse files Browse the repository at this point in the history
  • Loading branch information
eckrin committed Oct 7, 2023
1 parent 4646d39 commit a783ca5
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 24 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ dependencies {
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-validation'

implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'
implementation group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'
implementation 'org.springframework.boot:spring-boot-starter-security'

implementation 'io.springfox:springfox-boot-starter:3.0.0'
implementation 'io.springfox:springfox-swagger-ui:3.0.0'

implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5'
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/groupD/server/ServerApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableScheduling;

@EnableScheduling
@EnableJpaAuditing
@SpringBootApplication
public class ServerApplication {
//12
Expand Down
19 changes: 9 additions & 10 deletions src/main/java/com/groupD/server/config/SpringSecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,14 @@ public PasswordEncoder passwordEncoder() {

@Bean
public WebSecurityCustomizer webSecurityCustomizer() {
return web -> {
web.ignoring().antMatchers(
"/v3/api-docs/**",
"/swagger-resources/**",
"/swagger-ui/**",
"/swagger/**",
"/error",
"/auth/**"
);
};
return web -> web.ignoring().antMatchers(
"/v2/api-docs/**",
"/favicon.ico",
"/swagger-resources/**",
"/swagger-ui/**",
"/swagger/**",
"/error",
"/auth/**"
);
}
}
24 changes: 24 additions & 0 deletions src/main/java/com/groupD/server/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.groupD.server.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfig {

// 기본 swagger 선언
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ public class DateEntity {

@LastModifiedDate
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updatedDate;
private LocalDateTime updatedAt;
}
11 changes: 1 addition & 10 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,4 @@ spring:
hibernate:
ddl-auto: update
properties:
hibernate.format_sql: true
security:
oauth2:
client:
registration:
google:
client-id: 799333127259-2e22vu6n71ctc579itbpvpdivoa8am99.apps.googleusercontent.com
client-secret: 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
redirect-uri: http://localhost:8080/login/oauth2/code/google
scope: email, profile
hibernate.format_sql: true

0 comments on commit a783ca5

Please sign in to comment.