티스토리 뷰
728x90
@RestController
public class MyController {
@GetMapping("/test/{myEnum}")
public String getMyEnum(@PathVariable MyEnum myEnum) {
return "Hey " + myEnum;
}
}
public enum MyEnum {
HEY,
HELLO
}
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
@Component
public class MyEnumConverter implements Converter<String, MyEnum> {
@Override
public MyEnum convert(String value) {
return MyEnum.valueOf(value.toUpperCase());
}
}
https://vianneyfaivre.com/tech/spring-boot-enum-as-parameter-ignore-case
Spring Boot: How to ignore case when using an Enum as a Request parameter
Here is a way to enable the use of case-insensitive enumerations request parameters. You won’t need to do any code modification in your enum. Let’s say you have a controller class: @RestController public class MyController { @GetMapping("/test/{myEnum}
vianneyfaivre.com
728x90
'공부' 카테고리의 다른 글
[Link] regexr.com (0) | 2020.11.07 |
---|---|
[Spark] array to multiple rows (0) | 2020.11.07 |
[Java] convert current `date` to `integer` (0) | 2020.11.07 |
[Docker] basic (0) | 2020.10.30 |
[Kotlin] `val` vs `var` (0) | 2020.10.28 |
댓글
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 테슬라 추천
- 김달
- Bot
- 개리마커스
- 테슬라 크레딧 사용
- Kluge
- 테슬라 레퍼럴 코드 확인
- 팔로워 수 세기
- 테슬라 레퍼럴 적용 확인
- COUNT
- 클루지
- 할인
- 레퍼럴
- 연애학개론
- 유투브
- 모델y
- 메디파크 내과 전문의 의학박사 김영수
- 어떻게 능력을 보여줄 것인가?
- 테슬라 리퍼럴 코드 생성
- 책그림
- 테슬라 리퍼럴 코드
- 테슬라
- 모델 Y 레퍼럴
- 인스타그램
- 테슬라 리퍼럴 코드 혜택
- wlw
- follower
- 테슬라 레퍼럴
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함