본문 바로가기

maven4

[Spring security + Jwt #1] Spring Security 설정하기 1. dependency 설정 org.springframework.boot spring-boot-starter-security io.jsonwebtoken jjwt 0.9.1 jwt 토큰이 session 처럼 기본 설정으로 적용된 것이 아니기 때문에 dependency를 따로 추가 해줘야 합니다. 2. Spring Security 설정 class 생성 @Configuration @EnableWebSecurity @AllArgsConstructor public class WebSecurityConfig extends WebSecurityConfigurerAdapter { ... } @Configuration - 빈 등록 @EnableWebSecurity - Security class를 등록합니다. @All.. 2022. 2. 21.
[Spring Boot] profile 지정하여 실행하고자 할때 maven에서 실행 mvn install -Dspring.profiles.active=프로파일명 cli java -jar 실행 명령어 java -jar --spring.profiles.active=프로파일명 위에 이슈로 한시간 이상 빌드 배포만 미친듯이 한것 같다. 제발 다음엔 이런 간단한거로 힘 빼지 말자 ㅠㅠ 2022. 2. 16.
[설정] Spring boot profile 나누는 법 (Intellij Community) 1. 프로파일 나누기 파일의 위치는 보통 resources 하위에 만들어 주시면 됩니다. 코드 레벨이나 src 상위에서 application 파일을 만들어도 프로파일별 사용이 가능합니다. 2. Community 버전 실행시 VM 옵션 추가 Application 실행 설정창에서 Modify options > Add VM options를 클릭해 줍니다. 3. Maven 프로파일 참조 실행 스크립트 추가 "-" 뒤에 작성한 프로파일의 이름을 "=" 뒤에 작성해 주시면 됩니다. ex) application-dev -> -Dspring.profiles.active=dev 4. 실행 결과 확인 프로파일에 작성해둔 포트 번호로 서비스가 올라오는 것을 확인 가능합니다. 2022. 2. 15.
Spring Boot #2 [Mysql 연동] 오늘은 Mysql 연동을 해보겠습니다. - 준비물 1. Mysql 드라이브를 추가 합니다. 2. Mysql을 설치 합니다. 1. Mysql DataBase 만들기 - 구동에 앞서 Mysql을 설치해야 합니다. 버전은 Maven에 추가한 버전과 동일한 버전을 설치해 주세요. - 설치 방법 : 추후에 설치 관련 포스트를 추가 할게요~ - Mysql Client 실행하기 - 이제 DataBase 생성 커맨드를 입력합니다. 2. application.properties 파일에 Mysql 정보 입력 - 설정 파일 설명 spring.datasource.driver-class-name -> 드라이브를 명시 합니다. spring.datasource.url -> DB 접속 정보를 입력해 주세요. 예시) jdbc:db이름.. 2020. 6. 15.