Openssl을 이용한 Self Certificate CA(Certificate Authority) 인증 기관 Certificate Chain( 인증서 체인) Self Certificate 1. openssl을 사용하여 Certificate Authority의 비밀키 생성 openssl genrsa -des3 -out rootCA.key 20482. CA비밀키인 rootCA.key와 pair로 CA인증서 생성 openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.crt3. Server 비밀키 생성 openssl genrsa -out server.key 2048 4. Server 비밀키/공개키 및 CSR(Certificat..

Swagger UI 연동 1. pom.xml 에 dependency 추가 io.springfox springfox-swagger2 2.9.2 io.springfox springfox-swagger-ui 2.9.2 2. Swagger Configuartion에 @Bean 추가 @Configuration @EnableSwagger2 public class SwaggerConfiguration { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build(); } } 3. controller..
maven install 1. mvn install 할 때 spring-boot-maven-plugin 대신 maven-source-plugin을 추가해서 install spring-boot-maven-plugin을 써서 install하면 BOOT-INF안에 class들이 들어가게되서 , 해당 jar를 쓸 때 import가 안됨. 2. application-api-source.jar (source.jar) file 제외하고 install true pom.xml의 maven-source-plugin 에 configuration 추가
Spring boot에서 undertow 적용 1. pom.xml에서 tomcat을 exclude org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat 2. undertow dependency 추가 org.springframework.boot spring-boot-starter-undertow
Spring Cloud Config Client Spring Cloud 1. Spring Cloud Config Client , pom.xml Spring boot version 에 맞게 spring cloud version을 추가 1.8 Hoxton.SR12 dependencyManagement 추가 org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import 2. PropertiesConfiguration @RefreshScope @Data @Component public class ApplicationConfiguration { @Value("${app01.name}") private String name..
Spring Cloud Config Server Spring Cloud Config Spring Cloud Config는 환경설정을 spring application외부에서 모든 환경설정을 관리할수 있다. Spring Application(Spring Cloud Config Client) 이 실행되면서 Config Server에 접근해서 설정값을 가져오는 방식. 1. pom.xml 에 dependency 추가 org.springframework.cloud spring-cloud-config-server org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import 2. appliation.properties에 c..
Spring Batch Batch 데이터를 실시간으로 처리하는게 아닌, 특정 시간에 대량의 데이터를 일괄적으로 모아서 처리하는 작업. 사용자의 개입이 없어야함. 무엇이 잘못되었는지 추적할 수 있어야함.(logging등) 데이터를 충돌/중단 없이 안전하게 처리할 수 있어야함. 다른 application에 방해되지 않도록 과 독립적으로 수행. Spring Batch 구조 1. Read Database에서 특정 레코드 read2. Processing 사용자가 원하는방식으로 processing3. Write 수정된 데이터를 Database에 저장Read -> Processing -> Write 순서로 이루어져있음 Job Batch 처리 과정의 단위.JobInstance 배치처리에서 Job이 실행될 때 Job의 ..
Spring boot Scheduler 사용 일정 시간, 간격에 해당 로직을 돌리기 위해 사용한다. Spring Boot에서는 별도의 dependency를 추가할 필요 없이, Spring Boot Starter에서 Scheduler를 제공. 1. Spring Scheduler를 사용하기 위해서는 main class에 @EnableScheduling annotation을 추가. @EnableScheduling @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } } 2. @EnableSchedul..
Java File Watch Service WatchService를 이용한 디렉토리 변경 감지 1. WatchService를 사용해서 디렉토리 내의 file 삭제, 생성, 변경 감지. watchservice 의 create, modify, delete 감지 간단한 설명은 주석으로 ..... WatchService watchService = FileSystems.getDefault().newWatchService(); Path path = FileSystems.getDefault().getPath("D:/watchTestDir"); path.register(watchService, // Create Event StandardWatchEventKinds.ENTRY_CREATE, // Delete Event ..
Java JAXB Marshalling / UnMarshalling 1. Marshalling (POJO to xml) Value Object Class @Setter @XmlRootElement public class TestValue { @XmlElement public String name; @XmlElement public int age; } Marshalling TestValue testValue = new TestValue(); testValue.setAge(30); testValue.setName("name"); JAXBContext context = JAXBContext.newInstance(TestValue.class); Marshaller marshaller = context.creat..