본문 바로가기

프로그래밍/Spring

(10)
spring-loaded 사용해보기. (작성일 기준으로 1.2.8 버전이 최신버전) 자바(with Spring)를 개발하다보면 Class를 추가/변경 하는 작업을 많이 한다. 그럴때마다 서버를 리스타트하는 일은 엄청나게 번거로운 일이다. 그래서 자동으로 reload 시켜주는 걸 찾아봤다. 1. 설치하기 - pom.xml org.springframework.boot spring-boot-maven-plugin org.springframework springloaded 1.2.8.RELEASE - jar 다운로드(이 경우에는 다운로드한 경로를 따로 복사해 놓으세요.)http://mvnrepository.com/artifact/org.springframework/springloaded/1.2.8.RELEASE 4. Spring Boot 1) ma..
[Spring Social Facebook] Error message is (#12) bio field is deprecated for versions v2.8 and higher User Bios - The bio field on the User object is no longer available. If the bio field was set for a person, the value will now be appended to the about field. 1. 문제 - spring-social-facebook:2.0.3 에서 'PROFILE_FIELDS' 내 bio 필드가 있어서 안됨. (위 내용 참고) - https://developers.facebook.com/docs/graph-api/changelog 1) 해결법 - 기존소스 Connection connection = facebookConnectionFactory.createConnection(accessGrant); ..
[Spring Batch] 3. 하나의 App에 Multi Job 환경 구축 1. Multi Job - 한개의 Application 에서 여러개의 Job을 만들기 2. Job을 2개 만든다. 1) 이전 글에서 만든 Job/** * Basic Configuration * * @author akageun */ @Configuration public class BasicConfiguration { private static final Logger LOG = LoggerFactory.getLogger(BasicConfiguration.class); private static final String BASIC_JOB_NM = "BASIC_JOB"; private static final String BASIC_STEP_NM = "BASIC_TASKLET_STEP"; @Autowired pu..
[Spring Batch] 2. 기본 세팅 해보기 1. 기본 세팅 해보기 1) JOB 세팅하기@Autowired public JobBuilderFactory jobBuilderFactory; /** * Basic Job Configuration * * @return */ @Bean(name = BASIC_JOB_NM) public Job basicJob() { //@formatter:off return jobBuilderFactory .get(BASIC_JOB_NM) .incrementer(new RunIdIncrementer()) .start(basicTaskletStep()) .build(); //@formatter:on } 2) STEP(1) 기본 소스@Autowired public StepBuilderFactory stepBuilderFactor..
[Spring Batch] 1. 알아보자 1. Spring Batch 1) Spring batch란? - Spring Batch는 Job과 Step으로 구성되어 있음. - 하나의 Spring Batch안에는 여러 Job이 존재 할 수 있고, 그 Job 안에는 여러 개의 Step 또는 Tasklet을 존재 할 수 있음. - Job -> Step -> ItemReader - ItemProcessor - ItemWriter #https://docs.spring.io/spring-batch/trunk/reference/htmlsingle/#domain 에서 가져온 이미지 입니다. 2) 장점 - 간단하게 대용량 배치를 만들 수 있다. - 이미 만들어진 많은 모듈들을 사용해서 손쉽게 구현가능(CSV 파싱, DB에서 가지고 오기, S3 등에 파일업로드 등)..
[SPRING BOOT TIP] 3. BANNER.txt 를 이쁘게 만들어 보자 1. banner.txt?? - 위 이미지를 이쁘게 꾸며보자!.2. 변경할 파일 1) src/main/resources/banner.txt - banner.txt 내에 원하는 텍스트를 넣으면 된다. 2) 파일 위치도 변경하기 (1) 기본 설정(application.yml or application.propertioes)banner.location=classpath:banner.txt # Banner file location. - 원하는 경로로 변경하면 된다. 3. 이쁜 text 만들기 1) https://devops.datenkollektiv.de/banner.txt/index.html 2) http://patorjk.com/software/taag/#p=display&f=Ogre&t=Memorynotf..
[Spring Boot] H2, JPA로 Rest API 만들기 1. Goal - Spring boot web, H2 Database, JPA 를 사용해보기 - 간단한 REST API 만들기 - H2 web console 접속해보기 2. 세팅하기0) main Class - 프로젝트 생성하면 알아서 생성해준다.import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class H2JpaApplication { public static void main(String[] args) { SpringApplication.run(H2JpaApplication.class,..
[Spring Boot] Devtools 사용하기 1. DevTools 란 - spring boot 1.3.0부터 추가된 기능 - 소스가 변경되면 알아서 재시작 해줌. 2. 의존성 - Maven org.springframework.boot spring-boot-devtools - Gradlecompile("org.springframework.boot:spring-boot-devtools") 3. 영상 4. 링크https://spring.io/blog/2015/06/17/devtools-in-spring-boot-1-3 -----------2018.07.19 수정-------------------5. LiveReload - 리소스가 변경될 때 브라우저를 갱신시켜주는 서버를 포함하고 있음. - http://livereload.com/extensions/ 에..