Skip to content
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
11 changes: 10 additions & 1 deletion backend/JiShop/src/main/java/com/jishop/config/ShopDBConfig.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.jishop.config;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.orm.jpa.JpaTransactionManager;
Expand All @@ -20,7 +23,10 @@
transactionManagerRef = "shopTransactionManager"
)
@Configuration
@RequiredArgsConstructor
@Slf4j
public class ShopDBConfig {
private final Environment env;
@Primary
@Bean
public LocalContainerEntityManagerFactoryBean shopEntityManager() {
Expand All @@ -30,7 +36,10 @@ public LocalContainerEntityManagerFactoryBean shopEntityManager() {
em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());

Properties properties = new Properties();
properties.put("hibernate.hbm2ddl.auto", "create-drop");

properties.setProperty("hibernate.hbm2ddl.auto",
env.getProperty("spring.jpa.properties.hibernate.hbm2ddl.auto", "update"));

properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL8Dialect");
properties.setProperty("hibernate.physical_naming_strategy",
"org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy");
Expand Down
2 changes: 1 addition & 1 deletion backend/JiShop/src/main/resources/config
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class OrderServiceTest {

@Autowired
private OrderService orderService;
private OrderCreationService orderService;

private static final int THREAD_COUNT = 10;
private ExecutorService executorService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ public class ReviewIntegrationTest {
@Autowired
private OptionRepository optionRepository;

@Autowired
private ReviewService reviewService;

@Autowired
private CategoryRepository categoryRepository;

Expand Down
2 changes: 2 additions & 0 deletions backend/JiShop/src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ spring:
properties:
hibernate.format_sql: true # SQL 이쁘게 출력
hibernate.highlight_sql: true # SQL 컬러 출력
hibernate:
hbm2ddl.auto: create

data:
redis:
Expand Down