-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathFileConfig.java
More file actions
32 lines (26 loc) · 1.11 KB
/
FileConfig.java
File metadata and controls
32 lines (26 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.programmers.vouchermanagement.configuration;
import java.util.UUID;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.programmers.vouchermanagement.configuration.profiles.FileEnabledCondition;
import com.programmers.vouchermanagement.customer.domain.Customer;
import com.programmers.vouchermanagement.util.JSONFileManager;
import com.programmers.vouchermanagement.voucher.domain.Voucher;
@Configuration
@Conditional(FileEnabledCondition.class)
public class FileConfig {
@Bean
public ObjectMapper objectMapper() {
return new ObjectMapper();
}
@Bean("customer")
public JSONFileManager<UUID, Customer> customerJSONFileManager(ObjectMapper objectMapper) {
return new JSONFileManager<>(objectMapper, Customer.class);
}
@Bean("voucher")
JSONFileManager<UUID, Voucher> voucherJSONFileManager(ObjectMapper objectMapper) {
return new JSONFileManager<>(objectMapper, Voucher.class);
}
}