Skip to content

Commit 42142f6

Browse files
committed
[infra] docker파일 수정, docker compose 파일 수정 및 xml 매핑 에러 해결
1 parent b375b4a commit 42142f6

11 files changed

Lines changed: 124 additions & 47 deletions

File tree

.idea/workspace.xml

Lines changed: 22 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
1-
FROM openjdk:17-jdk-slim
1+
# 1. 빌드 단계
2+
FROM maven:3.9.3-eclipse-temurin-17 AS build
23
WORKDIR /app
3-
COPY . .
4+
5+
# Maven pom.xml 먼저 복사 후 의존성 다운로드
6+
COPY demo/pom.xml .
7+
RUN mvn dependency:go-offline -B
8+
9+
# 소스 복사
10+
COPY demo/src ./src
11+
12+
# JAR 빌드
13+
RUN mvn clean package -DskipTests
14+
15+
# 2. 실행 단계
16+
FROM eclipse-temurin:17-jdk-focal
17+
WORKDIR /app
18+
19+
# 빌드된 JAR만 복사
20+
COPY --from=build /app/target/demo-0.0.1-SNAPSHOT.jar app.jar
21+
422
EXPOSE 8080
5-
ENTRYPOINT ["java", "-jar", "demo-0.0.1-SNAPSHOT.jar"]
23+
ENTRYPOINT ["java", "-jar", "app.jar"]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//package com.example.moviezip.config;
2+
//
3+
//import lombok.Data;
4+
//import org.springframework.boot.context.properties.ConfigurationProperties;
5+
//import org.springframework.context.annotation.Configuration;
6+
//
7+
///**
8+
// * JWT 토큰 관련 설정값을 application.yml에서 읽어오는 클래스입니다.
9+
// * 모든 속성은 'token' 접두사를 사용합니다.
10+
// */
11+
//@Configuration
12+
//@ConfigurationProperties(prefix = "token")
13+
//@Data
14+
//public class TokenConfig {
15+
// // 토큰 서명에 사용되는 비밀 키
16+
// private String secret;
17+
//
18+
// // 액세스 토큰 만료 시간 (밀리초)
19+
// private Long accessTokenExpireTime;
20+
//
21+
// // 리프레시 토큰 만료 시간 (밀리초)
22+
// private Long refreshTokenExpireTime;
23+
//}

demo/src/main/java/com/example/moviezip/domain/Movie.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
package com.example.moviezip.domain;
22

3+
import lombok.Getter;
4+
import lombok.NoArgsConstructor;
5+
import lombok.Setter;
6+
import org.apache.ibatis.type.Alias;
7+
38
import java.io.Serializable;
49
import java.util.List;
510

11+
@Getter
12+
@Setter
13+
@Alias("Movie")
614
public class Movie implements Serializable {
715

816
private Long mvId;

demo/src/main/java/com/example/moviezip/domain/Review.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.example.moviezip.domain;
22

3+
import org.apache.ibatis.type.Alias;
4+
35
import java.io.Serializable;
46

7+
@Alias("Review")
58
public class Review extends Movie {
69
private Long rvId;
710
private int rvStar;
Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,15 @@
11
package com.example.moviezip.domain;
22

3-
import com.example.moviezip.domain.chat.ChatRoom;
4-
import lombok.Data;
53
import lombok.Getter;
64
import lombok.NoArgsConstructor;
75
import lombok.Setter;
8-
import org.springframework.security.core.GrantedAuthority;
9-
import org.springframework.security.core.userdetails.UserDetails;
10-
11-
import javax.persistence.*;
12-
import java.util.Collection;
13-
import java.util.List;
14-
6+
import org.apache.ibatis.type.Alias;
157

168
@Getter
179
@Setter
1810
@NoArgsConstructor
19-
@Entity
20-
@Table(name = "USER_TABLE")
21-
public class User {
22-
@Id
23-
@GeneratedValue(strategy = GenerationType.IDENTITY)
11+
@Alias("User")
12+
public class User {
2413
private Long id;
2514
private String userId;
2615
private String password;
@@ -31,10 +20,9 @@ public class User {
3120
public User(Long id) {
3221
this.id = id;
3322
}
34-
public User( String userId, String password) {
23+
24+
public User(String userId, String password) {
3525
this.userId = userId;
3626
this.password = password;
3727
}
38-
39-
40-
}
28+
}

demo/src/main/java/com/example/moviezip/util/jwtUtil.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ public class jwtUtil {
2222
private long ACCESS_TOKEN_EXPIRATION;
2323
@Value("${token.refresh-token-expire-time}")
2424
private long REFRESH_TOKEN_EXPIRATION;
25-
@Autowired
26-
private CustomUserDetailsService customUserDetailsService;
27-
//JWT 토큰 생성
25+
26+
//JWT 토큰 생성
2827
public String createAccessToken(Long userId, String username, String role) {
2928
Claims claims = Jwts.claims().setSubject(username);
3029
claims.put("userId", userId);

demo/src/main/resources/application-dev.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ spring:
1919

2020
jwt:
2121
secret: VlwEyVBsYt9V7zq57TejMnVUyzblYcfPQye08f7MGVA9XkHa
22+
23+
token:
24+
access-token-expire-time: 3000000
25+
refresh-token-expire-time: 604800000
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
spring:
22
application:
33
name: moviezip
4+
mybatis:
5+
type-aliases-package: com.example.moviezip.domain
6+
7+
jwt:
8+
secret: VlwEyVBsYt9V7zq57TejMnVUyzblYcfPQye08f7MGVA9XkHa
9+
10+
token:
11+
access-token-expire-time: 3000000
12+
refresh-token-expire-time: 604800000

demo/src/main/resources/com/example/moviezip/dao/mybatis/mapper/UserMapper.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<mapper namespace="com.example.moviezip.dao.mybatis.mapper.UserMapper">
55

66
<!-- 사용자를 가져옴 -->
7-
<select id="getUserById" resultType="User">
7+
<select id="getUserById" resultType="com.example.moviezip.domain.User">
88
SELECT * FROM USER_TABLE WHERE ID = #{id}
99
</select>
1010

@@ -16,19 +16,19 @@
1616
UPDATE USER_TABLE SET PASSWORD = #{newPassword} WHERE ID = #{id}
1717
</update>
1818

19-
<select id="findUser" resultType="User">
19+
<select id="findUser" resultType="com.example.moviezip.domain.User">
2020
SELECT * FROM USER_TABLE WHERE HINT = #{hint} AND NICKNAME = #{nickname}
2121
</select>
2222
<update id="updateUserNickname">
2323
UPDATE USER_TABLE SET NICKNAME = #{newNickname} WHERE ID = #{id}
2424
</update>
25-
<select id="existingUserNickname" resultType="User">
25+
<select id="existingUserNickname" resultType="com.example.moviezip.domain.User">
2626
SELECT * FROM USER_TABLE WHERE NICKNAME = #{nickname}
2727
</select>
2828
<delete id="deleteUser">
2929
DELETE FROM USER_TABLE WHERE ID = #{id}
3030
</delete>
31-
<select id="findAllUser" resultType="User">
31+
<select id="findAllUser" resultType="com.example.moviezip.domain.User">
3232
SELECT * FROM USER_TABLE
3333
</select>
3434

@@ -49,7 +49,7 @@
4949
<update id="updateInterest">
5050
UPDATE INTEREST SET GENRE = #{genre} WHERE ID = #{id}
5151
</update>
52-
<insert id="addUser" parameterType="User">
52+
<insert id="addUser" parameterType="com.example.moviezip.domain.User">
5353
<selectKey keyProperty="id" resultType="java.lang.Long" order="BEFORE">
5454
SELECT SEQUENCE_USERID.NEXTVAL FROM DUAL
5555
</selectKey>
@@ -59,7 +59,7 @@
5959
(#{id}, #{userId, jdbcType=VARCHAR}, #{password, jdbcType=VARCHAR}, #{nickname, jdbcType=VARCHAR}, #{hint, jdbcType=VARCHAR})
6060
</insert>
6161

62-
<select id="findAllUserInterest" resultType="User">
62+
<select id="findAllUserInterest" resultType="com.example.moviezip.domain.User">
6363
-- SELECT USER_TABLE.ID AS id, USER_TABLE.USER_ID AS user_id, USER_TABLE.PASSWORD AS password, USER_TABLE.NICKNAME AS nickname, USER_TABLE.HINT AS hint, INTEREST.GENRE AS interest
6464
SELECT USER_TABLE.ID AS id, USER_TABLE.UserId AS UserId, USER_TABLE.PASSWORD AS password, USER_TABLE.NICKNAME AS nickname, USER_TABLE.HINT AS hint, GENRE AS "interest.genre"
6565
FROM USER_TABLE
@@ -73,13 +73,13 @@
7373
WHERE MOVIE_TITLE LIKE '%' || #{keyword} || '%'
7474
</select>
7575

76-
<select id="findByUserId" resultType="User">
76+
<select id="findByUserId" resultType="com.example.moviezip.domain.User">
7777
SELECT *
7878
FROM USER_TABLE
7979
WHERE USERID = #{userId, jdbcType=VARCHAR}
8080
</select>
8181

82-
<select id="getUserById2" resultType="User">
82+
<select id="getUserById2" resultType="com.example.moviezip.domain.User">
8383
SELECT * FROM USER_TABLE WHERE ID = #{id}
8484
</select>
8585

0 commit comments

Comments
 (0)