Skip to content

Instantly share code, notes, and snippets.

View LeoHeo's full-sized avatar

JinHan LeoHeo

View GitHub Profile
branch-defaults:
default:
environment: null
group_suffix: null
global:
application_name: docker-test
branch: null
default_ec2_keyname: key name
default_platform: Docker 17.12.0
default_region: ap-northeast-2
Select a platform version.
1) Docker 17.12.0-ce
2) Docker 17.09.1-ce
3) Docker 17.06.2-ce
4) Docker 17.03.2-ce
5) Docker 1.12.6
6) Docker 1.11.2
7) Docker 1.9.1
(default is 1):
$ eb init
# 리젼선택 -> 애플리케이션 이름 정하기 -> Docker가 확실하냐? -> Docker 버젼선택 -> ssh 사용할꺼냐
# 여기까지 하게 되면 .elasticbeanstalk/config.yml파일이 생성된다.
# Force npm to run node-gyp also as root, preventing permission denied errors in AWS with npm@5
unsafe-perm=true

CommonOAuth2Provider

CommonOAuth2Provider pre-defines a set of default client properties for a number of well known providers: Google, GitHub, Facebook, and Okta.

  • spring security 5.0부터 생김
  • Google, Facebook, Github and Okta를 기본적으로 제공
  • WebSecurityConfigurerAdapter에서 oauth를 쓸라고 하면 boo-starter-security말고 아래 디펜던시도 추가
compile group: 'org.springframework.security', name: 'spring-security-oauth2-client', version: '5.0.3.RELEASE'
class StreamExamples {
public static void main(String[] args) {
final List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
numbers.stream()
.filter(number -> number > 3) // Intermediate Operation Method -> 즉시 연산을 안하고 기다린다.
.map(number -> number * 2) // Intermedidate Operation Method -> 즉시 연산을 안하고 기다린다.
.filter(number -> number > 10) // Intermedate Operation Method -> 즉시 연산을 안하고 기다린다.
.findFirst() // Terminal Operaion Method -> filter, map연산들을 한다.
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
/**
* @author Heo, Jin Han
* @since 2018-03-01
*/
class SuppplierExamples {
public static void main(String[] args) {
// 간단한 덧셈 뺄섬을 하는 Service class
// single responsibility principle도 위반
// 전혀 oop적인 코드도 아니다.
class CalculationService {
public int calculate(char calculation, int num1, int num2) {
if (calculation == '+') {
return num1 + num2;
} else if (calculation == '-') {
return num1 - num2;
}
- Single responsibility principle는 한가지의 일만 해야 한다가 아니다.
- 한가지의 이유료만 변화가 일어나야 한다가 정확하다.
Long orderId = 1L;
Order order = em.find(Order.class, orderId);
assertNotNull(order);
Member member = order.getMember();
Product product = order.getProduct();
assertNotNull(member.getUsername());