728x90
반응형
- [ Spring/Spring framework ]스프링 빈 자바코드로 직접 설정2022-12-21 11:17:27@Configuration public class SpringConfig { /* * 스프링 빈을 직접 설정 할 때의 장점 * : db 를 변경할때 repository 만 변경해주면 나머지 * 코드를 손대지 않고 변경 가능. * */ @Bean public MemberService memberService() { return new MemberService(memberRepository()); } @Bean public MemberRepository memberRepository() { return new MemoryMemberRepository(); } /* 아래 처럼 변경해주면 끝 @Bean public MemberRepository memberRepository() { return new DbMem..
- [ Spring/Spring framework ]Spring message arguments2022-03-30 11:46:23스프링 메시지를 사용하다보면 동적인 메시지를 출력해야하는 상황이 생긴다. 예시 : 나이별 출력 properties - > age = {0}세 일때 나이를 출력 결과에 따라 바꾸기 위해 Spring message 속성인 arguments 를 사용해보자. 이런식으로 arguments에 값을 할당하면 10세 20세 30세 이런식으로 출력된다 !
- [ Spring/Spring framework ]Email 보내기 2탄2022-03-18 15:45:42옛날에 한번 jsp 로 이메일 보내기 글을 쓴적있다. 근데 그냥 2탄으로 한번 써본다. 재공부~ 지금 만드는 이메일 전송법을 대충 설명하자면, 로그인시 해당 유저의 존재여부를 확인하고 있다면 인증코드를 발송하기 위함. 여튼 중요한것은 Email 보내는 거니까 거기에만 집중해보자. 일단 pom.xml 에 Email 을 보내기위한 dependency 를 추가해주자! 아 참고로 메이븐임.. com.sun.mail javax.mail 1.6.1 추가해주고 인텔리제이 기준 우측 상단에 메이븐 업데이트 버튼이 생성되는데 업데이트를 해주자 다음으로 root-context.xml 로 가서 Email 을 보내기 위한 bean 설정을 해주자. smtp true true true 본인의 이메일과 비밀번호를 입력하고 중요한 ..
- [ Spring/Spring framework ]Spring message properties2022-01-07 18:39:22spring framework 에서 사용하는 다국어 지원기능 일반적으로 하드코딩 식으로 다국어를 지원하려고 하면 일일이 변경해줘야 하는 상황이 발생하고 다국어를 지원 안하더라도 어떠한 하나의 단어를 변경해야 할 경우 모든 페이지를 찾아서 바꿔줘야하는 번거로움이 생긴다. 그럴때 Spring message 를 사용한다면 설정 파일에서 해당 단어를 찾아 바꿔주기만 한다면 모든 페이지에 적용이 가능하다. 따라서 spring message를 쓰자. 일일이 찾고 싶다면 말리지는 않겠다.. Spring 에서 제공하는 MessageSource 를 bean으로 등록해서 사용하면 관리가 편해지고 >웹어플리케이션의 리로딩 없이도 메시지 변경이 가능 하다고 한다. Spring 에서 제공하는 주요 Messagesource 구현..
- [ Spring/Spring framework ]Spring MVC Request life cycle2021-12-24 18:08:59Spring MVC Request life cycle 공부를 하다보니 내가 구조를 잘못 알고 있는가 싶어서 다시 해봄 이거는 그냥 spring 기본 구조 처음부터 싹 다시 훑어봐야겠다 https://docs.spring.io/spring-framework/docs/3.2.x/spring-framework-reference/html/mvc.html 17. Web MVC framework @RequestMapping(method = RequestMethod.POST) public String processSubmit(@ModelAttribute("pet") Pet pet, Model model, BindingResult result) { … } Note, that there is a Model paramet..
- [ Spring/Spring framework ]인터셉터2021-08-19 16:44:59https://rongscodinghistory.tistory.com/2
- [ Spring/Spring framework ]boot06 부트스트랩 이용한 게시판 만들기2021-08-11 17:20:13기본 세팅 pm.xml nz.net.ultraq.thymeleaf thymeleaf-layout-dialect 2.5.3 com.querydsl querydsl-jpa 4.4.0 com.querydsl querydsl-apt 4.4.0 com.mysema.maven apt-maven-plugin 1.1.3 process target/generated-sources/java com.querydsl.apt.jpa.JPAAnnotationProcessor 플러그인을 추가하면 자동으로 생성된다. 안생긴다면 프로젝트의 메이븐을 업데이트! package com.bit.controller; import org.springframework.beans.factory.annotation.Autowired; import o..
- [ Spring/Spring framework ]boot052021-08-11 14:48:55https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#appendix-b-expression-utility-objects 식 참고 페이지 Tutorial: Using Thymeleaf 1 Introducing Thymeleaf 1.1 What is Thymeleaf? Thymeleaf is a modern server-side Java template engine for both web and standalone environments, capable of processing HTML, XML, JavaScript, CSS and even plain text. The main goal of Thymeleaf is to provide a www...
- [ Spring/Spring framework ]thymeleaf2021-08-10 16:48:51https://www.thymeleaf.org/ Thymeleaf Integrations galore Eclipse, IntelliJ IDEA, Spring, Play, even the up-and-coming Model-View-Controller API for Java EE 8. Write Thymeleaf in your favourite tools, using your favourite web-development framework. Check out our Ecosystem to see more integrati www.thymeleaf.org package com.bit.controller; import java.sql.Timestamp; import java.util.ArrayList; imp..
- [ Spring/Spring framework ]JPA2021-08-09 17:59:57페이징처리 https://gunju-ko.github.io/spring/2018/05/01/Spring-Data-JPA-Paging.html Spring Data JPA를 활용한 페이징 처리 Spring Data JPA를 이용한 페이징 처리 PagingAndSortingRepository PagingAndSortingRepository는 CrudRepository를 상속하고 있는 인터페이스이다. PagingAndSortingRepository는 페이징 처리를 위한 메소드를 제공하고 있다. p gunju-ko.github.io https://itmining.tistory.com/139 [Spring Boot] Pagination과 Sort 1. 개요 Pagination은 큰 데이터를 표현할 때 도움이 됩니..
- [ Spring/Spring framework ]boot04 회원게시판2021-08-09 16:26:19spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/jpadb?useUnicode=yes&characterEncoding=UTF-8&useSSL=false spring.datasource.username=root spring.datasource.password=1234 #ddl : Data Definition Language : 데이터 정의 -> create #아래 코드는 JPA 코드 자동생성이라서 한번 생성시키고 주석처리 #spring.jpa.hibernate.ddl-auto=create spring.jpa.hibernate.ddl-auto=update #DDL ..
- [ Spring/Spring framework ][JPA] boot3 데이터 DB 입출력2021-08-09 12:50:48https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods JPA keyword는 여기서 찾자! Spring Data JPA - Reference Documentation Example 109. Using @Transactional at query methods @Transactional(readOnly = true) interface UserRepository extends JpaRepository { List findByLastname(String lastname); @Modifying @Transactional @Query("delete from User u where u.active = false") v..
728x90
반응형