Redis는 많은 곳에 적용 할 수 있는 훌륭한 IN-Memory NoSQL DB이다. 세션 관리를 위해 Redis를 많이 사용하는데 누군가에게 데이터를 탈취 당한다면 인증을 하지않은 사용자가 서버를 휘젓고 다닐 수 있다. 그렇기 때문에 Redis 인스턴스를 보호하는 것은 굉장히 중요하다.
다음과 같이 세 가지 방법으로 Redis 인스턴스들을 보호할 수 있다.
- 비밀번호 설정하기
- 커맨드 명령어 바꾸기
- 네트워크 보안
JDK 8에서 추가된 Stream API에 대해서 알아보자.(파일 I/O에서 사용되는 스트림과는 다르다.)스트림은 데이터소스를 추상화하고, 데이터를 다루는데 자주 사용되는 메서들을 정의해 놓았다. 데이터소스를 추상화하였다는 것은, 데이터 소스가 무엇이든 같은 방식으로 다룰 수 있게 되었다는 것과 코드의 재사용성이 높아진다는 것을 의미한다. 먼저, 코드를 보면서 차이를 느껴보자.
//Stream 사용 전
String[] strArr = { "mash-up", "backend", "codingsquid" }
List<String> strList = Arrays.asList(strArr);
Arrays.sort(strArr);
Collections.sort(strList);
@Bean(destroyMethod = "close")
public EntityManagerFactory entityManagerFactory(DataSource dataSource) {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(true);
vendorAdapter.setShowSql(true);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("org.codingsquid.isolation.entity");
In Spring Batch, a Job is simply a container for Steps. It combines multiple steps that belong logically together in a flow and allows for configuration of properties global to all steps, such as restartability.
The job configuration contains
Chunk-oriented processing is not the only way to process in a Step. What if a Step must consist as a simple stored procedure call? You could implement the call as an ItemReader and return null after the procedure finishes, but it is a bit unnatural since there would need to be a no-op ItemWriter. Spring Batch provides the TaskletStep for this scenario.
The Tasklet is a simple interface that has one method, execute, which will be a called repeatedly by the TaskletStep until it either returns RepeatStatus.FINISHED or throws an exception to signal a failure. Each call to the Tasklet is wrapped in a transaction. Tasklet implementors might call a stored procedure, a script, or a simple SQL update statement
설정시 특징
<appender name="privateLogAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/private.${port:-default}.log</file>