Skip to content

Commit

Permalink
Merge pull request #63 from Team-INSERT/Feat/migrateForSpringBoot3
Browse files Browse the repository at this point in the history
Feat/migrate for spring boot3
  • Loading branch information
qlido authored Mar 13, 2024
2 parents 759f07c + f0dca15 commit 387a662
Show file tree
Hide file tree
Showing 35 changed files with 192 additions and 202 deletions.
86 changes: 46 additions & 40 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ buildscript {

plugins {
id 'java'
id 'org.springframework.boot' version '2.7.6'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10'
id 'org.springframework.boot' version '3.2.3'
id 'io.spring.dependency-management' version '1.1.4'
// id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10' //querydsl double compile error 발생함
//SonarCloud
id "org.sonarqube" version "3.5.0.2730"
//SonarCloud test coverage
Expand All @@ -19,71 +19,70 @@ group = 'com.project'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}

dependencies {
implementation 'org.projectlombok:lombok:1.18.22'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
// implementation 'org.springdoc:springdo c-openapi-ui:1.6.6'
//default SpringBoot
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.5.8'
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"

implementation 'io.jsonwebtoken:jjwt:0.9.1'
//DB Connect And Logging
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.5.8'
runtimeOnly 'com.mysql:mysql-connector-j'

implementation 'org.springframework.boot:spring-boot-starter-data-redis'
//lombok
implementation 'org.projectlombok:lombok:1.18.22'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'

//test
testImplementation 'org.springframework.security:spring-security-test'
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
testImplementation 'org.springframework.boot:spring-boot-starter-test'

//jwt
implementation 'io.jsonwebtoken:jjwt:0.9.1'
implementation 'com.fasterxml.jackson.core:jackson-core:2.14.0'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.14.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.0'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.14.0'

//bsm-oauth-java
implementation 'com.github.leehj050211:bsm-oauth-java:1.0.0'

//string diff
implementation 'org.bitbucket.cowwoc:diff-match-patch:1.2'
//mac issue 해결
implementation 'io.netty:netty-resolver-dns-native-macos:4.1.68.Final:osx-aarch_64'

implementation 'org.bitbucket.cowwoc:diff-match-patch:1.2'

//querydsl 추가
implementation "com.querydsl:querydsl-jpa:${queryDslVersion}"
annotationProcessor "com.querydsl:querydsl-apt:${queryDslVersion}"
implementation "com.querydsl:querydsl-jpa:${queryDslVersion}:jakarta"
annotationProcessor "com.querydsl:querydsl-apt:${queryDslVersion}:jakarta"
annotationProcessor "jakarta.persistence:jakarta.persistence-api:3.1.0" // java.lang.NoClassDefFoundError(javax.annotation.Entity) 발생 대응
annotationProcessor "jakarta.annotation:jakarta.annotation-api" // java.lang.NoClassDefFoundError (javax.annotation.Generated) 발생 대응

//aws s3
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.638'
}

tasks.named('test') {
useJUnitPlatform()
}


//querydsl 추가
def querydslDir = "$buildDir/generated/querydsl"

querydsl {
jpa = true
querydslSourcesDir = querydslDir
tasks.withType(JavaCompile).configureEach {
options.getGeneratedSourceOutputDirectory().set(file(querydslDir))
}
sourceSets {
main.java.srcDir querydslDir
}

compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
main.java.srcDirs += [querydslDir]
}

configurations {
Expand All @@ -93,6 +92,15 @@ configurations {
querydsl.extendsFrom compileClasspath
}

clean {
delete file(querydslDir)
}

//spring6부터 추가된 경고문구 해결
configurations.configureEach {
exclude group: 'commons-logging', module: 'commons-logging'
}

//sonarCloud
sonarqube {
properties {
Expand All @@ -104,14 +112,12 @@ sonarqube {
//sonarCloud testCoverage
jacocoTestReport {
reports {
xml.enabled true
xml.required = true
}
}

tasks.named('test') {
useJUnitPlatform()
}

//plain jar 비활성화
jar {
enabled = false
}


Binary file removed gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 0 additions & 5 deletions gradle/wrapper/gradle-wrapper.properties

This file was deleted.

35 changes: 22 additions & 13 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.springframework.data.redis.core.TimeToLive;
import org.springframework.data.redis.core.index.Indexed;

import javax.persistence.Id;
import jakarta.persistence.Id;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.springframework.data.redis.core.TimeToLive;
import org.springframework.data.redis.core.index.Indexed;

import javax.persistence.Id;
import jakarta.persistence.Id;
import java.time.ZonedDateTime;

@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import java.time.LocalDateTime;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToOne;

import org.springframework.data.annotation.CreatedDate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import lombok.*;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import jakarta.persistence.*;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -37,9 +37,11 @@ public class Docs {
@LastModifiedDate
private LocalDateTime lastModifiedAt;

@Builder.Default
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<VersionDocs> docsVersion = new ArrayList<>();

@Builder.Default
@OneToMany(mappedBy = "docs", cascade = CascadeType.ALL)
private List<Contribute> contributor = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import lombok.*;
import org.springframework.data.annotation.CreatedDate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime;

@Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.project.bumawiki.domain.docs.domain.type.DocsType;
import lombok.Getter;

import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotBlank;

@Getter
public class DocsCreateRequestDto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import lombok.Getter;

import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotBlank;

@Getter
public class DocsTitleUpdateRequestDto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.project.bumawiki.domain.docs.domain.type.DocsType;
import lombok.Getter;

import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotBlank;

@Getter
public class DocsTypeUpdateDto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import lombok.Getter;

import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;

@Getter
public class DocsUpdateRequestDto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import java.io.IOException;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
package com.project.bumawiki.domain.image.presentation;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;

@ConstructorBinding
@Getter
@RequiredArgsConstructor
@ConfigurationProperties(prefix = "image")
public class FileStorageProperties {
private String path;

public String getPath() {
return path;
}

public void setPath(String path) {
this.path = path;
}
private final String path;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.project.bumawiki.domain.user.domain.User;
import lombok.*;

import javax.persistence.*;
import jakarta.persistence.*;
import java.util.Objects;

@Entity
Expand Down
Loading

0 comments on commit 387a662

Please sign in to comment.