Skip to content

Commit

Permalink
Feat: AwsConfig 로직 생성[박한솔]
Browse files Browse the repository at this point in the history
  • Loading branch information
pjhcsols committed May 4, 2024
1 parent 81b1b2a commit caa4549
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ out/

.DS_Store

### .application.properties ###
### application.properties ###
#application.properties
5 changes: 5 additions & 0 deletions basilium-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ dependencies {

implementation 'com.google.code.gson:gson:2.9.0'
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign:4.0.3'

//s3
implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE'
implementation 'software.amazon.awssdk:s3:2.17.84' // 사용하고자 하는 AWS SDK 버전에 맞게 변경

}

ext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;

@Entity
@Getter @Setter
@NoArgsConstructor
Expand Down Expand Up @@ -34,11 +36,23 @@ public class Product {
@Column(name="product_desc", nullable = false)
String productDesc;

@ElementCollection
@CollectionTable(name = "product_photo_urls", joinColumns = @JoinColumn(name = "product_id"))
@Column(name = "product_photo_url")
List<String> productPhotoUrl;

@ElementCollection
@CollectionTable(name = "product_sub_photo_urls", joinColumns = @JoinColumn(name = "product_id"))
@Column(name = "product_sub_photo_url")
List<String> productSubPhotoUrl;

/*
@Column(name="product_photo_url")
String productPhotoUrl;
@Column(name="product_sub_photo_url")
String productSubPhotoUrl;
*/

@ManyToOne
@JoinColumn(name = "brand_user_number") // BrandUser와의 관계를 나타내는 외래 키
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package basilium.basiliumserver.s3Storage.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
import org.springframework.beans.factory.annotation.Value;

@Configuration
public class AwsConfig {

@Value("${cloud.aws.region.static}")
private String region;

@Bean
public S3Client s3Client() {
return S3Client.builder()
.region(Region.of(region))
.build();
}
}

11 changes: 11 additions & 0 deletions basilium-server/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ spring.servlet.multipart.enabled=true
spring.servlet.multipart.max-file-size=1GB
spring.servlet.multipart.max-request-size=2GB

#s3 git
cloud.aws.credentials.accessKey=bean
cloud.aws.credentials.secretKey=bean
cloud.aws.stack.auto=false

# AWS S3 Service bucket
cloud.aws.s3.bucket=
cloud.aws.region.static=ap-northeast-2

# AWS S3 Bucket URL
cloud.aws.s3.bucket.url=

# Oauth-google
social.client.google.rest-api-key=temp
Expand Down

0 comments on commit caa4549

Please sign in to comment.