Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #5

Merged
merged 6 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM lpicanco/java11-alpine
VOLUME /tmp
ARG JAR_FILE=./build/libs/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
services:
database:
image: mysql
container_name: feelin_db
environmnet:
- MYSQL_DATABASE=feelinDB
- MYSQL_ROOT_HOST=%
- MYSQL_ROOT_PASSWORD=feelin
command: ['--character-set-server=utf8mb4', '--character-set-server=utf8mb4_unicode_ci']

ports:
- 3306:3306
volumes:
- /home/revision/docker_spring/database/feelinDB/:/var/lib/mysql
networks:
- feelin_network_02

application:
build: .
restart: always
ports:
- 80:8080
depends_on:
- database
container_name: app_test01
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://localhost:3306/feelin?serverTimezone=UTC
SRPING_DATASOURCE_USERNAME: feelin
SPRING_DATASOURCE_PASSWORD: feelin
networks:
- feelin_network_02
networks:
feelin_network_02:
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ package com.wafflestudio.msns.domain.artist.model

import com.wafflestudio.msns.domain.album.model.Album
import com.wafflestudio.msns.domain.model.BaseEntity
import com.wafflestudio.msns.domain.user.model.User
import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.FetchType
import javax.persistence.OneToMany
import javax.persistence.OneToOne
import javax.persistence.Table
import javax.validation.constraints.NotBlank

Expand All @@ -18,9 +16,6 @@ class Artist(
@field:NotBlank
val artistName: String,

@OneToOne(mappedBy = "artist")
val user: User,

@OneToMany(mappedBy = "artist", fetch = FetchType.LAZY, cascade = [])
val albums: MutableList<Album> = mutableListOf(),

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package com.wafflestudio.msns.domain.user.model

import com.wafflestudio.msns.domain.artist.model.Artist
import com.wafflestudio.msns.domain.model.BaseEntity
import javax.persistence.CascadeType
import javax.persistence.Entity
import javax.persistence.FetchType
import javax.persistence.OneToOne
import javax.persistence.Table
import javax.persistence.UniqueConstraint
import javax.validation.constraints.NotBlank
Expand All @@ -27,7 +23,4 @@ class User(
@field:NotBlank
var password: String,

@OneToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
val artist: Artist? = null,

) : BaseEntity()
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
package com.wafflestudio.msns.global.config

import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity
import org.springframework.security.config.annotation.web.builders.HttpSecurity
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
import org.springframework.security.config.http.SessionCreationPolicy
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
import org.springframework.security.crypto.password.PasswordEncoder

@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableWebSecurity
class SecurityConfig()
class SecurityConfig() : WebSecurityConfigurerAdapter() {
@Bean
fun passwordEncoder(): PasswordEncoder {
return BCryptPasswordEncoder()
}

override fun configure(http: HttpSecurity) {
http
.csrf().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
}
}
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ spring:
jpa:
generate-ddl: true
hibernate:
ddl-auto: create
ddl-auto: create