Skip to content

Commit

Permalink
10주차 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
jinseohyun1228 committed Nov 6, 2024
1 parent 19bab83 commit 40a8edc
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
Expand Down Expand Up @@ -31,6 +32,7 @@ public RedisConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisConfig);
}

@Primary
@Bean
public RedisTemplate<String, String> redisTemplate() {
RedisTemplate<String, String> redisTemplate = new RedisTemplate<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public class WebConfig implements WebMvcConfigurer {

@Override
public void addFormatters(FormatterRegistry registry) {
// registry.addConverter(new MainStepEnumConverter());
// registry.addConverter(new SubStepEnumC onverter());
registry.addConverter(new MainStepEnumConverter());
registry.addConverter(new SubStepEnumConverter());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
public class MainStepEnumConverter implements Converter<String, MainStepEnum> {
@Override
public MainStepEnum convert(String value) {
// return MainStepEnum.fromStepName(value);
return null;
return MainStepEnum.fromStepName(value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public enum MainStepEnum {
this.subStepEnumList = subStepEnumList;
}

// @JsonCreator
// public static MainStepEnum fromStepName(String stepName) {
// for (MainStepEnum mainStepEnum : MainStepEnum.values()) {
// if (mainStepEnum.mainStepName.equals(stepName)) {
// return mainStepEnum;
// }
// }
// throw new IllegalArgumentException(ErrorCode.PROGRESS_MAIN_INVALID_NAME.getMessage());
// }
@JsonCreator
public static MainStepEnum fromStepName(String stepName) {
for (MainStepEnum mainStepEnum : MainStepEnum.values()) {
if (mainStepEnum.mainStepName.equals(stepName)) {
return mainStepEnum;
}
}
throw new IllegalArgumentException(ErrorCode.PROGRESS_MAIN_INVALID_NAME.getMessage());
}

@JsonValue
public String getMainStepName() {
Expand Down
20 changes: 11 additions & 9 deletions boomerang/src/main/java/boomerang/progress/domain/SubStepEnum.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package boomerang.progress.domain;

import boomerang.global.response.ErrorCode;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public enum SubStepEnum {
Expand All @@ -14,15 +16,15 @@ public enum SubStepEnum {
this.content = content;
}

// @JsonCreator
// public static SubStepEnum fromStepName(String stepName) {
// for (SubStepEnum subStepEnum : SubStepEnum.values()) {
// if (subStepEnum.subStepName.equals(stepName)) {
// return subStepEnum;
// }
// }
// throw new IllegalStateException(ErrorCode.PROGRESS_SUB_INVALID_NAME.getMessage());
// }
@JsonCreator
public static SubStepEnum fromStepName(String stepName) {
for (SubStepEnum subStepEnum : SubStepEnum.values()) {
if (subStepEnum.subStepName.equals(stepName)) {
return subStepEnum;
}
}
throw new IllegalStateException(ErrorCode.PROGRESS_SUB_INVALID_NAME.getMessage());
}

@JsonValue
public String getSubStepName() {
Expand Down

0 comments on commit 40a8edc

Please sign in to comment.