본문 바로가기

반응형

Spring

(15)
Spring properties 설정 Spring에서는 properties를 통해서 mysql, port, log설정등 여러 기능을 제공한다. 다음은 주로 사용하는 기능을 알아보자. server.servlet.context-path=/mit server.port=9999 spring.datasource.driver-class-name=org.mariadb.jdbc.Driver spring.datasource.url=jdbc:mariadb://127.0.0.1:3306/sns spring.datasource.username=root spring.datasource.password=비밀번호 logging.level.root=WARN logging.level.com.sns.mappers=TRACE #mapper location settings m..
Spring git으로 pull 받은 프로젝트 임폴트가안될때 import Projects from File System or Archive로 한다.
Spring 설치하기 및 설정하기 Spring 3.9.12 버전을 기준으로 한다. new -> Spring starter Project 실행 적당한 프로젝트 명을 설정후 next Spring Boot DevTools, Sprnig Web, Spring Web Services 세계를 설치 언어 설정을 UFT-8로 적용한다.
Spiring JWt를 이용한 토큰 생성 Dependency io.fusionauth fusionauth-jwt 3.4.0 junit junit 4.7 login API @ApiOperation(value = "로그인 처리") @PostMapping("login") public ResponseEntity login(@RequestBody Member member) { System.out.println(member.getUserid()); member = memberService.login(member); if (member != null) { String token = getToken(member); return new ResponseEntity(token, HttpStatus.OK); } else { return new ResponseEnti..
Spring의 느낌을 느껴보자 mybatis-config.xml 이곳은 mybatis를 사용할때 typeAliases를 통해서 별칭을 지정할 수 있다. com.ssafy.boardspring.dto.BaordDto 를 boardDto로 별칭해줌으로서 패키지에 class 파일을 접근 할수 있다. mappers/*.xml ( myBatis DB 접근) select id, name, mailid, start_date, manager_id, title, dept_id , ifnull(salary,0.0) salary, ifnull(commission_pct,0.0) commission_pct from s_emp order by id select id, name, mailid, start_date, manager_id, title, dept_..
Spring : web.xml web application의 설정을 위한 deployment descriptor - Deploy할 때 Servlet의 정보를 설정해준다. - 브라우저가 Java Servlet에 접근하기 위해서는 WAS에 필요한 정보를 알려줘야 해당하는 Servlet을 호출할 수 있다. 1. 배포할 Servelt이 무엇인지 2. 해당 Servlet이 어떤 URL에 매핑되는지 contextConfigLocation /WEB-INF/spring/root-context.xml org.springframework.web.context.ContextLoaderListener appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB..
Spring : pom.xml Project Object Model 의 약어로서 프로젝트 내부 빌드 옵션을 설정해 주는 곳이다. pom.xml은 ... 형태로 둘러싸여서 section별로 여러 정보를 나타내며 설정할 수 있다. : 프로젝트를 생성한 조직 또는 그룹명 . 보통 URL 역순으로 사용. : 고유이름 : 애플리케이션의 버전 : jar, war, ear, pom 등 패키지 유형을 나타낸다. : 프로젝트 명 : 프로젝트 설명 : 프로젝트를 찾을 수 있는 URL : pom.xml에서 중복해서 사용되는 설정(쌍수) 값들을 지정해놓는 부분. : 들을 묶어놓는곳 : MYSQL , JDBC등 여러 라이브러리를 설정할 수 있는곳 추가하면 자동으로 다운로드한다. 4.0.0 com.ssafy boardspring board_spring war..

반응형