
Spring Web static resources 오늘은 Spring Web에서 지원해주는 정적 리소스 경로 맵핑에 대해 공유해보겠습니다. 정적 리소스는 동적으로 만들어지지 않는 리소스 ex) 사진, javascript 등을 말합니다. 기본 리소스 위치 classpath:/static classpath:/public classpath:/resources classpath:/META-INF/resources html 생성 프로젝트 resources → static → hello.html hello.html Hello Static Resource 오호호 서버 실행 후 브라우저에서 확인해보겠습니다. 개발자 도구 (F12)를 열어서 Network 탭을 열어둔 후 다시 새로고침을 해보면 응답 코드가 200이 아닌..

안녕하세요. 이번엔 Spring boot를 처음 시작하시는 분들을 위해 프로젝트 생성부터 시작해보도록 하겠습니다. 우선 저는 Intellij Ultimate를 사용 중입니다. Intellij 기준으로 진행되는 점 양해 바랍니다. 1. Create Project 2. Spring initializer 왼쪽 패널에서 Spring Initializer를 선택 후 자신의 Java 버전을 선택합니다. 3. 설정 원하는 설정으로 해줍니다 Type은 저는 Gradle로 선택을 했습니다. 4. Dependencies 추가 프로젝트를 만들면서 의존성을 추가해줄 수 있는데 - Spring Web - Spring boot Devtools - Lombok - Thymeleaf - Spring Data JPA - H2 (사진에..

개발 하던 중 택배추적 API를 서버에서 호출하여 처리하는 로직을 구현하게되었습니다. RestTemplate으로 개발 중 알게된 내용을 정리하여 공유해보겠습니다. 더 좋은 방법이나 이상한 점이 있다면 댓글로 알려주시면 감사하겠습니다. Examples getForEntity() String baseUrl = "localhost:8088/api/v1/test"; RestTemplate restTemplate = new RestTemplate(); ResponseEntity response = restTemplate.getForEntity(baseUrl, String.class); getForEntity를 사용하면 위와같이 ResponseEntity 객체를 return 받을 수 있습니다. getForObjec..
@Formula Spring boot Hibernate @Formula 사용하여 Count 하기 프로젝트를 진행할 떄 게시판을 만든다는 가정을 한다. 게시글 댓글이 1:N의 관계이다. 만약 게시글을 불러오면서 댓글의 총 갯수를 알고 싶을때 @Formula 어노테이션을 유용하게 사용 할 수 있을 듯하다. Entity 수정 @Entity public class Board { private Long id; private String title; private String contents; @Formual("(select count(1) from board_comment bc where bc.board_id = id)") private int totalCommentCount; } @Formula 어노테이션을 붙..

Spring security Setting Spring boot 에 Securiry dependency를 추가하고 간단하게 설정하는 방법을 포스팅합니다. 부족한 부분은 계속 수정할 예정입니다. build.gradle implementation 'org.springframework.boot:spring-boot-starter-security' 위와 같이 dependecy 추가하고 프로젝트를 실행해보면 모든 요청에 Security가 걸리게 되어 기본 로그인 화면으로 Redirect됩니다. 기본 로그인 정보는 콘솔 log 를 확인해보면 아래와 같이 자동으로 비밀번호가 생성된 것을 확인할 수 있습니다. Default ID : user 하지만 모든 연결을 Security가 막는것을 원하지 않기 때문..
Password Encoder✓Spring Security password Encoder스프링 시큐리티 권장 PasswordEncoderPasswordEncoderFactories.createDelegationPasswordEncoder기본 알고리즘 : bcrypt패스워드 같은 중요한 정보는 암호화를 꼭 해줘야한다.단방향 암호화를하면 좋다해싱 알로리즘 & 솔트 (salt)해싱은 말 그대로 유저가 입력한 비밀번호에 약간의 소금을 치는 것이다. 약간의 문자열을 추가하여 암호화를 한다.실제 적용Bean 등록@Configuration public class AppConfig { @Bean public PasswordEncoder passwordEncoder() { return PasswordEncoderFact..
- Total
- Today
- Yesterday
- JPA
- Python
- 스프링
- howtoinstallnginx
- like절
- Security
- QueryDSL
- ubuntu
- 스프링시큐리티
- 유사결과
- 개발
- @formula
- 자바
- springboot
- Java
- 웹서비스
- java11
- 스프링부트 시작하기
- ControllerAdvice
- 스프링부트
- springsecurity
- paawordencoder
- spring web
- API
- booleanExpression
- mapstruct
- ResourceHttpReqeustHandler
- boot
- FastAPI
- Spring
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |