본문 바로가기

Study

(19)
[SpringBoot] REST API REST API 구현 Controller 생성 -CustomerController.java package kr.ac.hansung.cse.controller; import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; imp..
[SpringBoot] security, logging(slf4j) security 설정 -pom.xml org.springframework.boot spring-boot-starter-security 위의 코드를 추가해준다. SecurityConfig class 생성 java class를 사용해 configuration authorization을 설정해준다. - SecurityConfig.java package kr.ac.hansung.cse.config; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security..
[SpringBoot] 다양한설정 Spirng과 SpringBoot의 개발할 때의 차이점이 무엇인가 알아보고자 Spring Boot를 한번 사용해보았다. Spring Boot ( vs SpringMVC) Auto Configuration : 최소한의 설정으로 애플리케이션 개발 (xml, annotation, java class) convention over configuration Easy Dependency Management (spring-boot-starter) : 관련 라이브러리 (호환 버전) 다운로드 예 : spring-boot-starter-web : spring, web mvc, jackson, validation, ... SpringBoot 세팅 Springboot 프로젝트 생성 Tomcat (app1.war, app2.w..
[Spring] Store - Cart View / AngularJS - RestAPI / 오류해결 AngularJS 를 활용하여 CartView 생성하기. Cart메뉴 생성 사용자가 로그인하면 Cart메뉴가 보이도록 Cart메뉴를 생성한다. Cart 위의 코드를 menu.jsp애 추가 -menu.jsp https://docs.spring.io/spring-security/site/docs/5.0.x/reference/html/csrf.html 19. Cross Site Request Forgery (CSRF) So what are the steps necessary to use Spring Security’s to protect our site against CSRF attacks? The steps to using Spring Security’s CSRF protection are outlined ..
[Spring] Store - Cart View (장바구니) / AngularJS - RestAPI Angular를 사용해 CartView 구현 AngularJs란? - Front-end Framework AngularJs : javascript framework (MVC지원) AngularJs extends HTML wwith ng-directives Angluar : typescript Work Flow RestAPI 구현 CartRestController.java 생성 package kr.ac.hansung.cse.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springf..
[Spring] Store - CartModel / REST API REST API를 사용하여 CART(장바구니) 서비스 구현 DB 관계도 하나의 product가 여러개의 cart item에 담겨 여러개의 cart에 담길 수 있다. List은 DB에 따로 저장하지 않는다. Cart와 CartItem 생성 -Cart.java package kr.ac.hansung.cse.model; import java.util.ArrayList; import java.util.List; import lombok.Getter; import lombok.Setter; import lombok.ToString; @Getter @Setter @ToString public class Cart { private int id; private List cartItems = new ArrayList()..
[Spring] Store - Product Detail Product의 info 아이콘을 를 누르면 Product Detail 페이지 (상세 페이지)로 이동할 수 있도록 구현한다. 뷰 수정 width:100% -> 50% style의 width를 줄여 이미지 크기를 줄여주었다. fontawesome 페이지에서 아이콘 가져오기(잘 작동되지 않으니 참고만 하기) https://fontawesome.com/ Font Awesome The world’s most popular and easiest to use icon set just got an upgrade. More icons. More styles. More Options. fontawesome.com 해당 코드를 카피하여 아이콘을 넣고 싶은 곳에 복사해준다. All Products 착한 가격으로 상품을 살펴..
[Spring] Store - Register User / Spring security Spring security를 활용한 유저 등록 기능 구현 user와 shippingaddress class 추가생성 -User.java package kr.ac.hansung.cse.model; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; i..