nhkiiim / til Goto Github PK
View Code? Open in Web Editor NEWToday I Learned
Home Page: https://github.com/nhkiiim/TIL/discussions
Today I Learned
Home Page: https://github.com/nhkiiim/TIL/discussions
git clone 이후 변경사항이 있어도 commit 되지 않음
On branch master
nothing to commit, working tree clean
RN 프로젝트 실행 시 발생
$ npm run android
This is probably not a problem with npm. There is likely additional logging output above.
react native 프로젝트 생성 시 발생
$ npx react-native init [프로젝트명]
TypeError: cli.init is not a function
배치 테스트를 진행하다 여러번 실행시켜 내가 CPU를 다 잡아먹고 있는 상태 발생..! 어플리케이션을 종료해도 끊기지 않았기 때문에 우선 session kill 하기로 결정..
CommDto를 만들어 DTO에서 상속 받고
@Data
를 사용하는 경우 경고 발생
다른 클래스를 확장하는 클래스에
@Data
적용 시@EqualsAndHashCode
로 인해 컴파일 경고 발생
Generating equals/hashCode implementation but without a call to superclass, even though this class does not extend java.lang.Object. If this is intentional, add '@EqualsAndHashCode(callSuper=false)' to your type.
iframe으로 tab을 구현한 상황에서 권한이 없거나 인증이 만료되었을 때 스프링 시큐리티를 통해 로그인 페이지로 리디렉트 되는데,
iframe 내부에서 로그인 페이지로 이동하는 상황 발생 (화면 중첩)
자바에서 PreparedStatement 인터페이스를 활용해 동적 SQL을 생성하는 것을 MyBatis로 변환 필요한 상황
기존 자바 코드의 다이나믹 쿼리 생성을 위한 조건문 예시
if (listDto.getDtoList().size() > 0 ) {
if( ... 조건 ) {
query.append(" and CD = ");
query.append(listDto.getDtoList(0).getCd());
}
if ( ... 조건 ) {
query.append(" and YN = ");
query.append(listDto.getDtoList(0).getYn());
} else {
query.append(" and YN = '0' ");
}
} else {
query.append(" and YN = '0'");
}
DTO 예시 (조건에 필요한 DTO가 리스트 형태로 전달 됨 - 비교에 필요한 객체는 하나 뿐 (0번 인덱스))
구조 전환 작업이기 때문에 입출력 형태 변경 불가
@Data
public class ListDto extends BaseDto {
private List<Dto> dtoList;
...
}
@Valid
적용 시 List(Collection) 내부까지 유효성 검사가 진행되지 않았음
@RequestMapping("...")
public Json<?> modify(@RequestBody @Valid Form form) {
return service.modify(form);
}
PostgreSQL에서 ON CONFLICT 구문 사용 시 시퀀스를 함께 사용하면 conflict 조건을 확인을 위해 시퀀스 값을 입력하게 되고,
자동으로 시퀀스를 생성해주는 INSERT인 경우 NULL 값이 들어가며 NOT NULL 제약조건을 위반
INSERT INTO 테이블 ( TEST_ID, TEST_NM ) VALUES
( 5, 'name' ) ON CONFLICT ( TEST_ID ),
( NULL, 'name' ) ON CONFLICT ( TEST_ID )
DO UPDATE SET
TEST_NM = 'name'
PostgreSQL SERIAL : #101
git add
명령어 입력 시 발생
warning: LF will be replaced by CRLF the next time Git touches it
멀티 모듈 프로젝트 import 중
.project
파일이 각각 존재하지 않아 인식이 안되는 경우 발생
.project
파일의 경우 이클립스에서 사용하는 프로젝트 디스크립션 파일으로 이클립스에서 프로젝트로 인식하기 위해 필요하다.
다만 다른 IDE를 사용할 경우 필요 없는 파일이기 때문에 .gitignore로 무시되는 경우가 있어 주의해야함!!
프로프레임 ➡️ 스프링부트로 전환하는 프로젝트 진행 중 순환참조 문제 발생
@RequiredArgsConstructor
를 활용한 생성자 주입으로 의존성 주입서비스1
메서드A
-> 서비스2
메서드B
호출서비스2
메서드C
-> 서비스3
메서드D
호출서비스3
메서드E
-> 서비스1
메서드F
호출auto increment되는 시퀀스를 가져와 저장해야 하는 경우 (두개의 테이블에 같은 키값으로 저장, 이미지 저장 후 게시글 저장)
MyBatisuseGeneratedKeys
를 통해 INSERT 이후 auto increment Key 값 가져오려 했으나 오류 발생
<insert id="save" useGeneratedKeys="true" keyProperty="[VO 변수명]"
parameterType="... Vo$Test">
nested exception is org.apache.ibatis.executor.ExecutorException:
Error getting generated key or setting result to parameter object.
Cause: org.apache.ibatis.executor.result.ResultMapException:
Error attempting to get column #1 from result set.
Cause: org.postgresql.util.PSQLException: Bad value for type long : PJT00012
Dto에서 BaseDto를 extends 한 상황에서,
@Builder
를 사용해 빌더 패턴으로 BaseDto의 필드 설정 시 컴파일 오류 발생
BaseDto (부모클래스)
@Data
public class BaseDto {
private Long seq;
private Long size;
...
}
Dto
@Data
@Builder
@EqualsAndHashCode(callSuper = true)
public class Dto extends BaseDto {
private List<...> dtoList;
...
}
return Dto.builder()
.dtoList(mapper.select(...))
.seq(...) // 오류 발생 !!
.build();
Mybatis enum 타입을 분기를 위한 조건문에 사용 시 에러 발생 (당근,, Enum 타입이니까,, ㅠㅁㅜ )
<insert id="updateUser" parameterType="...">
UPDATE USER
SET USER_STT = #{userStt}
<if test="role == 'ROLE_GUEST' and userStt != '03'">
ROLE = #{role}
</if>
WHERE USER_ID = #{userId}
</insert>
spring-boot-starter-validation 라이브러리 추가 후 build.gradle 을 refresh 했음에도
@NotBlank
와 같은org.hibernate.validator
(spring-boot-starter-validation안에 포함)의 클래스를 import 할 수 없는 상황 발생
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation
implementation 'org.springframework.boot:spring-boot-starter-validation:3.0.5'
프로프레임 -> 스프링 전환 사전 분석 과정에서
addBath()
,executeBatch()
를 마이바티스 Mapper 인터페이스로 변환하면서 마이바티스의 foreach 사용
처리량이 많아
addBath()
후 나누어서executeBatch()
를 수행하는 상황은 아니었고, 한번의executeBatch()
만 수행, 자세한 데이터 처리량 확인 필요
@Builder
사용 시 발생,builder()
사용 시 괜찮다가@RequestBody
사용 시 발생
Cannot construct instance of `[Class Reference]` (no Creators, like default constructor, exist):
cannot deserialize from Object value (no delegate- or property-based Creator)
로컬 서버에서는 스프링 시큐리티 적용이 너무 잘 되는데!!! 개발 서버만 가면 오류 발생
java.lang.NoClassDefFoundError: org/springframework/security/config/annotation/web/builders/HttpSecurity
처음 테이블 구조를 유지하는 것이 가장 좋겠지만, 추가 요구사항 발생으로 개발 도중 테이블에 컬럼을 추가해야하는 상황 발생!
컬럼 추가 시 테이블의 마지막에 추가되는데 컬럼 순서를 바꾸고 싶을 때 DBMS별 다른 방식으로 변경 가능
테이블을 새로 생성해 순서를 변경하려는 경우 코멘트나 권한들이 사라지거나
제약 조건에 문제가 발생할 수 있으므로 꼭 필요할 때에만 변경하기
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.