본문 바로가기

스프링(Spring)

(5)
STS가 열리지 않을때 ini 파일에서 메모리 변경, 자바 버전 설정 후에도 sts 파일 실행이 안되어서 불필요한 부분들 삭제 후 실행이 됨 -startup plugins/org.eclipse.equinox.launcher_1.5.800.v20200727-1323.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1300.v20200819-0940 -product org.springframework.boot.ide.branding.sts4 --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.8 -Xms512m -Xmx8192m --add-modules=AL..
STS 에 svn 연동하기(안될때 수동설치) eclipse에는 기본적으로 connector가 포함되어 있다. sts는 Help → Eclipse marketplace → Subversive SVN Team Provider 설치 → confirm으로 설치 진행→ STS 재시작 → window → preferences → get connectors → svn connector 설치 (설치 안되면) → help → install new software → work with(https://community.polarion.com/projects/subversive/download/eclipse/6.0/update-site/) svn connectors, connectors sources 다 설치 → 재실행 → svn repository exploring 확인
spring batch, spring scheduler, spring quartz 알아보기 Spring scheduler은 활성화를 위해 EnableScheduling 어노테이션을 붙여주면 된다. @EnableScheduling @SpringBootApplication public class BatchApplication { public static void main(String[] args) { SpringApplication.run(BatchApplication.class, args); } } 특징으로는 method는 void return 타입을 가져야한다 method는 파라미터를 가질수없다 @Component @EnableAsync public class ScheduleTest { @Scheduled(fixedDelay = 1000) // 작업이 끝난 시점부터 시간 세기 public vo..
@AuthenticationPrincipal @AuthenticationPrincipal 은 Spring Security에서 인증된 사용자의 정보를 추출할 때 사용된다. 인증된 사용자의 정보를 가져오면, 컨트롤러에서 해당 사용자의 권한을 확인하거나 사용자에게 특정한 권한을 요구하는 기능 등을 구현 할수 있다. 이번 메인 프로젝트에서 이 어노테이션이 사용 되었는데 postman 요청시 Authorization 을 빼고 요청을 했을때 응답값이 500 에러가 떴다. 내 개인적인 생각으론 Authorization 을 빼고 요청 했을때 null 값이 들어오면서 @AuthenticationPrincipal 때문에 사용자 인증이 되지 않은 상태이고, 그러므로 401 Unauthorized 가 뜰것이라고 예상했었지만, 어떠한 이유때문인지 500 에러가 떴다. 아..
[SpringMVC] API 계층(Controller) 시작하기 1. 애플리케이션의 경계를 설정하기, 요구 사항 수집하기 2. 패키지 구조 생성하기 - 기능기반 패키지 구조 - 기능을 위주로 패키지를 나누어 클래스들을 관리하는 방식을 뜻한다. - 계층기반 패키지 구조 - Controller, DTO (API 계층) Model, Service(비지니스 계층), Repository(데이터 엑세스 계층) 으로 나누어서 클래스들 을 관리 하는걸 뜻한다. 3. 엔트리포인트 클래스 작성 (애플리케이션 시작점) - main() 메서드가 포함된 엔트리 포인트 클래스 작성이 필요하지만 ‘Spring Initializr’ 를 이용해서 생성한 프로젝트는 이미 작성이 되어있다 import org.springframework.boot.SpringApplication; import ..