+ All Categories
Home > Technology > Spring framework 4.x

Spring framework 4.x

Date post: 05-Aug-2015
Category:
Upload: yongkwon-park
View: 679 times
Download: 0 times
Share this document with a friend
44
SPRING FRAMEWORK 4.X 박용권 - Software Engineer, SK planet Themes and Trends
Transcript
Page 1: Spring framework 4.x

SPRING FRAMEWORK 4.X

박용권����������� ������������������  -����������� ������������������  Software����������� ������������������  Engineer,����������� ������������������  SK����������� ������������������  planet

Themes����������� ������������������  and����������� ������������������  Trends

Page 2: Spring framework 4.x

2013년 1월 16일 - Next Stop: Spring Framework 4.0

Page 3: Spring framework 4.x

2013년 1월 16일 - Next Stop: Spring Framework 4.0

코어 프레임워크의 다음 버전이 4.0이 될것이라는 기쁜소식을 전합니다.

3.2 버전은 3.x 라인의 마지막 버전이 될것입니다.

3.x 버전에서는 JAVA 7, Servlet 3.0의 지원 및 자바 코드 기반 설정, REST에 초점을 두었습니다.

4.0은 엔터프라이즈 통합에 중심을 두고 개발이 진행될것입니다.

2013년 말에 릴리즈를 될것이며, 4월에 첫번째 마일스톤을 공개할 예정입니다.

Page 4: Spring framework 4.x

Java 8|

✓����������� ������������������  Lambda����������� ������������������  Expressions����������� ������������������  

✓����������� ������������������  Method����������� ������������������  References����������� ������������������  

✓����������� ������������������  JSR-310(Date����������� ������������������  and����������� ������������������  Time����������� ������������������  API)����������� ������������������  

✓����������� ������������������  Concurrency����������� ������������������  API����������� ������������������  additions����������� ������������������  

✓����������� ������������������  Reflection����������� ������������������  and����������� ������������������  annotation

✓����������� ������������������  Collections����������� ������������������  API����������� ������������������  additions����������� ������������������  

✓����������� ������������������  Stream����������� ������������������  API����������� ������������������  

✓����������� ������������������  IO/NIO����������� ������������������  API����������� ������������������  additions����������� ������������������  

✓����������� ������������������  Nashorn����������� ������������������  JavaScript����������� ������������������  Engine����������� ������������������  

✓����������� ������������������  Other

Page 5: Spring framework 4.x

List<Player> players = playerRepository.findAll(); Collections.sort(players, new Comparator<Player>() { public int compare(Player p1, Player p2) { return p1.getRank().compareTo(p2.getRank()); } });

Lambda Expressions & New Collection API|

요즘 함수형 프로그래밍이 대세라던데?

스칼라나 그루비는

고차함수를 지원한다더라!

자바야. 우리도 람다식 좀 쓰고 싶다!

무슨 할말이 이렇게

많니?

Page 6: Spring framework 4.x

List<Player> players = playerRepository.findAll();Collections.sort(players, new Comparator<Player>() { public int compare(Player p1, Player p2) { return p1.getRank().compareTo(p2.getRank()); } });

players.sort((p1, p2) -> p1.getRank().compareTo(p2.getRank()));

Lambda Expressions & New Collection API|

결국...

Page 7: Spring framework 4.x

Easy database queries for Java 8|

String sql = "SELECT * FROM Customer C WHERE C.Name = ? "; PreparedStatement statement = conn.prepareStatement(sql); statement.setString(1, "Alice"); ResultSet rs = statement.executeQuery(); List<Customer> customers = new ArrayList<>(); while (rs.next()) { // customers.add(..)}

database.customerStream().where( customer -> customer.getName().equals("Alice"));

JinQ

Page 8: Spring framework 4.x

JSR-310(Date And Time API)|

// 1일 후 구하기 void shouldGetAfterOneDay() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd"); LocalDate theDay = IsoChronology.INSTANCE.date(2015, 5, 26); isTrue(formatter.format(theDay).equals("2015.05.26")); LocalDate nextDay = theDay.plusDays(1); isTrue(formatter.format(nextDay).equals("2015.05.27")); } // 1시간 후 구하기void shouldGetAfterOneHour() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd HH:mm"); ZoneId seoul = ZoneId.of("Asia/Seoul"); ZonedDateTime theTime = ZonedDateTime.of(2015, 5, 26, 17, 0, 0, 0, seoul); isTrue(theTime.format(formatter).equals("2015.05.26 17:00")); ZonedDateTime after1Hour = theTime.plusHours(1); isTrue(after1Hour.format(formatter).equals("2015.05.26 18:00")); } // 요일 확인하기 void shouldGetDayOfWeek() { LocalDate theDay = LocalDate.of(2015, 5, 26); DayOfWeek dayOfWeek = theDay.getDayOfWeek(); isTrue(dayOfWeek.equals(DayOfWeek.TUESDAY)); }

Page 9: Spring framework 4.x

Java EE 7|

✓����������� ������������������  JSM����������� ������������������  -����������� ������������������  Java����������� ������������������  Messaging����������� ������������������  Service����������� ������������������  2.0����������� ������������������  (JSR-343)����������� ������������������  

✓����������� ������������������  JPA����������� ������������������  -����������� ������������������  Java����������� ������������������  Persistence����������� ������������������  API����������� ������������������  2.1����������� ������������������  (JSR-338)����������� ������������������  

✓����������� ������������������  JTA����������� ������������������  -����������� ������������������  Java����������� ������������������  Transaction����������� ������������������  API����������� ������������������  1.2����������� ������������������  (JSR-907)����������� ������������������  

✓����������� ������������������  Bean����������� ������������������  Validation����������� ������������������  1.1����������� ������������������  (JSR-349)����������� ������������������  

✓����������� ������������������  Java����������� ������������������  API����������� ������������������  for����������� ������������������  WebSocket����������� ������������������  (JSR-356)����������� ������������������  

✓����������� ������������������  Concurrency����������� ������������������  Utilities����������� ������������������  for����������� ������������������  Java����������� ������������������  EE����������� ������������������  1.0����������� ������������������  (JSR-236)����������� ������������������  

✓����������� ������������������  Java����������� ������������������  Servlet����������� ������������������  3.1����������� ������������������  (JSR-340)����������� ������������������  

✓����������� ������������������  Batch����������� ������������������  Applications����������� ������������������  for����������� ������������������  the����������� ������������������  Java����������� ������������������  Platform����������� ������������������  (JSR-352)����������� ������������������  

✓����������� ������������������  Other

Page 10: Spring framework 4.x

Java API for WebSocket (JSR-356)|

JSR 356: Java API for WebSocket

✓ HTML5 표준 ✓ API: W3C / 프로토콜: IETF ✓ 웹 소켓 프로토콜 사용 ✓ 양방향 통신

✓ Tomcat 7.0.47+ and 8.0 ✓ Jetty 9.0 and 9.1 ✓ WildFly 8.0 (JBoss Application Server) ✓ GlassFish 4.0

Page 11: Spring framework 4.x

2013년 1월 16일 - Next Stop: Spring Framework 4.0

2013년 12월 12일 - 4.0 Release

✓ First-class����������� ������������������  support����������� ������������������  for����������� ������������������  Java����������� ������������������  SE����������� ������������������  8����������� ������������������  based����������� ������������������  Spring����������� ������������������  applications����������� ������������������  ✓ Configuring����������� ������������������  and����������� ������������������  implementing����������� ������������������  Spring-style����������� ������������������  applications����������� ������������������  using����������� ������������������  Groovy����������� ������������������  2����������� ������������������  ✓ Support����������� ������������������  for����������� ������������������  key����������� ������������������  Java����������� ������������������  EE����������� ������������������  7����������� ������������������  technologies����������� ������������������  ✓ Enabling����������� ������������������  WebSocket-style����������� ������������������  application����������� ������������������  architectures����������� ������������������  ✓ Fine-grained����������� ������������������  eventing����������� ������������������  and����������� ������������������  messaging����������� ������������������  within����������� ������������������  the����������� ������������������  application����������� ������������������  ✓ Pruning����������� ������������������  and����������� ������������������  dependency����������� ������������������  upgrades

✓ New����������� ������������������  application����������� ������������������  architectures����������� ������������������  -����������� ������������������  micro-service,����������� ������������������  reactive����������� ������������������  event-driven����������� ������������������  ,����������� ������������������  messaging����������� ������������������  ✓ Modernization����������� ������������������  -����������� ������������������  Java����������� ������������������  8����������� ������������������  support,����������� ������������������  support����������� ������������������  for����������� ������������������  3rd����������� ������������������  party����������� ������������������  libraries����������� ������������������  latest����������� ������������������  versions����������� ������������������  ✓ Working����������� ������������������  with����������� ������������������  the����������� ������������������  JCP����������� ������������������  -����������� ������������������  spring����������� ������������������  collaborates����������� ������������������  in����������� ������������������  JCP����������� ������������������  (Java����������� ������������������  EE����������� ������������������  specifications),����������� ������������������  Java����������� ������������������  EE����������� ������������������  6����������� ������������������  and����������� ������������������  7����������� ������������������  support

Page 12: Spring framework 4.x

Microservices|

<service>

<service>

<service>

!

" " "

#

%&

'

(

REST����������� ������������������  API

REST����������� ������������������  API����������� ������������������  /����������� ������������������  STOMP

message

) **

<client>

*

<service>

<database>

<database>

“마이크로����������� ������������������  서비스”는����������� ������������������  서비스����������� ������������������  디자인����������� ������������������  스타일로서����������� ������������������  작은����������� ������������������  서비스의����������� ������������������  결

합을����������� ������������������  통해����������� ������������������  하나의����������� ������������������  응용프로그램을����������� ������������������  개발하는����������� ������������������  방법으로,����������� ������������������  각각의����������� ������������������  서비

스는����������� ������������������  독립적인����������� ������������������  비즈니스����������� ������������������  로직으로����������� ������������������  구성되며,����������� ������������������  완전히����������� ������������������  자동화된����������� ������������������  방법

으로����������� ������������������  독립적으로����������� ������������������  배포될����������� ������������������  수����������� ������������������  있다.����������� ������������������  서로����������� ������������������  HTTP,����������� ������������������  JMX,����������� ������������������  JMS,����������� ������������������  AMQP,����������� ������������������  

STOMP,����������� ������������������  REST����������� ������������������  API����������� ������������������  같은����������� ������������������  가벼운����������� ������������������  통신����������� ������������������  메커니즘을����������� ������������������  사용한다.����������� ������������������  서비

스들을����������� ������������������  위해����������� ������������������  최소한의����������� ������������������  중심적인����������� ������������������  관리����������� ������������������  체계가����������� ������������������  있으며,����������� ������������������  서비스들은����������� ������������������  

다른����������� ������������������  프로그래밍����������� ������������������  언어로����������� ������������������  개발될����������� ������������������  수����������� ������������������  있고,����������� ������������������  다른����������� ������������������  데이터����������� ������������������  저장����������� ������������������  기술을����������� ������������������  

사용할����������� ������������������  수도����������� ������������������  있다.

<api����������� ������������������  gateway>

Page 13: Spring framework 4.x

Microservices|

<service>

<service>

<service>

!

" " "

#

%&

'

(

REST����������� ������������������  API

REST����������� ������������������  API����������� ������������������  /����������� ������������������  STOMP

message

) **

<client>

*

<service>

<database>

<database>

“마이크로����������� ������������������  서비스”는����������� ������������������  서비스����������� ������������������  디자인����������� ������������������  스타일로서����������� ������������������  작은����������� ������������������  서비스의����������� ������������������  결

합을����������� ������������������  통해����������� ������������������  하나의����������� ������������������  응용프로그램을����������� ������������������  개발하는����������� ������������������  방법으로,����������� ������������������  각각의����������� ������������������  서비

스는����������� ������������������  독립적인����������� ������������������  비즈니스����������� ������������������  로직으로����������� ������������������  구성되며,����������� ������������������  완전히����������� ������������������  자동화된����������� ������������������  방법

으로����������� ������������������  독립적으로����������� ������������������  배포될����������� ������������������  수����������� ������������������  있다.����������� ������������������  서로����������� ������������������  HTTP,����������� ������������������  JMX,����������� ������������������  JMS,����������� ������������������  AMQP,����������� ������������������  

STOMP,����������� ������������������  REST����������� ������������������  API����������� ������������������  같은����������� ������������������  가벼운����������� ������������������  통신����������� ������������������  메커니즘을����������� ������������������  사용한다.����������� ������������������  서비

스들을����������� ������������������  위해����������� ������������������  최소한의����������� ������������������  중심적인����������� ������������������  관리����������� ������������������  체계가����������� ������������������  있으며,����������� ������������������  서비스들은����������� ������������������  

다른����������� ������������������  프로그래밍����������� ������������������  언어로����������� ������������������  개발될����������� ������������������  수����������� ������������������  있고,����������� ������������������  다른����������� ������������������  데이터����������� ������������������  저장����������� ������������������  기술을����������� ������������������  

사용할����������� ������������������  수도����������� ������������������  있다.

<api����������� ������������������  gateway>

<Monoliths and Microservices>

Page 14: Spring framework 4.x

Microservices|

<service>

<service>

<service>

!

" " "

#

%&

'

(

REST����������� ������������������  API

REST����������� ������������������  API����������� ������������������  /����������� ������������������  STOMP

message

) **

<client>

*

<service>

<database>

<database>

“마이크로����������� ������������������  서비스”는����������� ������������������  서비스����������� ������������������  디자인����������� ������������������  스타일로서����������� ������������������  작은����������� ������������������  서비스의����������� ������������������  결

합을����������� ������������������  통해����������� ������������������  하나의����������� ������������������  응용프로그램을����������� ������������������  개발하는����������� ������������������  방법으로,����������� ������������������  각각의����������� ������������������  서비

스는����������� ������������������  독립적인����������� ������������������  비즈니스����������� ������������������  로직으로����������� ������������������  구성되며,����������� ������������������  완전히����������� ������������������  자동화된����������� ������������������  방법

으로����������� ������������������  독립적으로����������� ������������������  배포될����������� ������������������  수����������� ������������������  있다.����������� ������������������  서로����������� ������������������  HTTP,����������� ������������������  JMX,����������� ������������������  JMS,����������� ������������������  AMQP,����������� ������������������  

STOMP,����������� ������������������  REST����������� ������������������  API����������� ������������������  같은����������� ������������������  가벼운����������� ������������������  통신����������� ������������������  메커니즘을����������� ������������������  사용한다.����������� ������������������  서비

스들을����������� ������������������  위해����������� ������������������  최소한의����������� ������������������  중심적인����������� ������������������  관리����������� ������������������  체계가����������� ������������������  있으며,����������� ������������������  서비스들은����������� ������������������  

다른����������� ������������������  프로그래밍����������� ������������������  언어로����������� ������������������  개발될����������� ������������������  수����������� ������������������  있고,����������� ������������������  다른����������� ������������������  데이터����������� ������������������  저장����������� ������������������  기술을����������� ������������������  

사용할����������� ������������������  수도����������� ������������������  있다.

<api����������� ������������������  gateway>

Page 15: Spring framework 4.x

Microservices|

<service>

<service>

<service>

!

" " "

#

%&

'

(

REST����������� ������������������  API

REST����������� ������������������  API����������� ������������������  /����������� ������������������  STOMP

message

) **

<client>

*

<service>

<database>

<database>

“마이크로����������� ������������������  서비스”는����������� ������������������  서비스����������� ������������������  디자인����������� ������������������  스타일로서����������� ������������������  작은����������� ������������������  서비스의����������� ������������������  결

합을����������� ������������������  통해����������� ������������������  하나의����������� ������������������  응용프로그램을����������� ������������������  개발하는����������� ������������������  방법으로,����������� ������������������  각각의����������� ������������������  서비

스는����������� ������������������  독립적인����������� ������������������  비즈니스����������� ������������������  로직으로����������� ������������������  구성되며,����������� ������������������  완전히����������� ������������������  자동화된����������� ������������������  방법

으로����������� ������������������  독립적으로����������� ������������������  배포될����������� ������������������  수����������� ������������������  있다.����������� ������������������  서로����������� ������������������  HTTP,����������� ������������������  JMX,����������� ������������������  JMS,����������� ������������������  AMQP,����������� ������������������  

STOMP,����������� ������������������  REST����������� ������������������  API����������� ������������������  같은����������� ������������������  가벼운����������� ������������������  통신����������� ������������������  메커니즘을����������� ������������������  사용한다.����������� ������������������  서비

스들을����������� ������������������  위해����������� ������������������  최소한의����������� ������������������  중심적인����������� ������������������  관리����������� ������������������  체계가����������� ������������������  있으며,����������� ������������������  서비스들은����������� ������������������  

다른����������� ������������������  프로그래밍����������� ������������������  언어로����������� ������������������  개발될����������� ������������������  수����������� ������������������  있고,����������� ������������������  다른����������� ������������������  데이터����������� ������������������  저장����������� ������������������  기술을����������� ������������������  

사용할����������� ������������������  수도����������� ������������������  있다.

<api����������� ������������������  gateway>

Page 16: Spring framework 4.x

Microservices|

<service>

<service>

<service>

!

" " "

#

%&

'

(

REST����������� ������������������  API

REST����������� ������������������  API����������� ������������������  /����������� ������������������  STOMP

message

) **

<client>

*

<service>

<database>

<database>

“마이크로����������� ������������������  서비스”는����������� ������������������  서비스����������� ������������������  디자인����������� ������������������  스타일로서����������� ������������������  작은����������� ������������������  서비스의����������� ������������������  결

합을����������� ������������������  통해����������� ������������������  하나의����������� ������������������  응용프로그램을����������� ������������������  개발하는����������� ������������������  방법으로,����������� ������������������  각각의����������� ������������������  서비

스는����������� ������������������  독립적인����������� ������������������  비즈니스����������� ������������������  로직으로����������� ������������������  구성되며,����������� ������������������  완전히����������� ������������������  자동화된����������� ������������������  방법

으로����������� ������������������  독립적으로����������� ������������������  배포될����������� ������������������  수����������� ������������������  있다.����������� ������������������  서로����������� ������������������  HTTP,����������� ������������������  JMX,����������� ������������������  JMS,����������� ������������������  AMQP,����������� ������������������  

STOMP,����������� ������������������  REST����������� ������������������  API����������� ������������������  같은����������� ������������������  가벼운����������� ������������������  통신����������� ������������������  메커니즘을����������� ������������������  사용한다.����������� ������������������  서비

스들을����������� ������������������  위해����������� ������������������  최소한의����������� ������������������  중심적인����������� ������������������  관리����������� ������������������  체계가����������� ������������������  있으며,����������� ������������������  서비스들은����������� ������������������  

다른����������� ������������������  프로그래밍����������� ������������������  언어로����������� ������������������  개발될����������� ������������������  수����������� ������������������  있고,����������� ������������������  다른����������� ������������������  데이터����������� ������������������  저장����������� ������������������  기술을����������� ������������������  

사용할����������� ������������������  수도����������� ������������������  있다.

<api����������� ������������������  gateway>

Page 17: Spring framework 4.x

Microservices|

<service>

<service>

<service>

!

" " "

#

%&

'

(

REST����������� ������������������  API

REST����������� ������������������  API����������� ������������������  /����������� ������������������  STOMP

message

) **

<client>

*

<service>

<database>

<database>

“마이크로����������� ������������������  서비스”는����������� ������������������  서비스����������� ������������������  디자인����������� ������������������  스타일로서����������� ������������������  작은����������� ������������������  서비스의����������� ������������������  결

합을����������� ������������������  통해����������� ������������������  하나의����������� ������������������  응용프로그램을����������� ������������������  개발하는����������� ������������������  방법으로,����������� ������������������  각각의����������� ������������������  서비

스는����������� ������������������  독립적인����������� ������������������  비즈니스����������� ������������������  로직으로����������� ������������������  구성되며,����������� ������������������  완전히����������� ������������������  자동화된����������� ������������������  방법

으로����������� ������������������  독립적으로����������� ������������������  배포될����������� ������������������  수����������� ������������������  있다.����������� ������������������  서로����������� ������������������  HTTP,����������� ������������������  JMX,����������� ������������������  JMS,����������� ������������������  AMQP,����������� ������������������  

STOMP,����������� ������������������  REST����������� ������������������  API����������� ������������������  같은����������� ������������������  가벼운����������� ������������������  통신����������� ������������������  메커니즘을����������� ������������������  사용한다.����������� ������������������  서비

스들을����������� ������������������  위해����������� ������������������  최소한의����������� ������������������  중심적인����������� ������������������  관리����������� ������������������  체계가����������� ������������������  있으며,����������� ������������������  서비스들은����������� ������������������  

다른����������� ������������������  프로그래밍����������� ������������������  언어로����������� ������������������  개발될����������� ������������������  수����������� ������������������  있고,����������� ������������������  다른����������� ������������������  데이터����������� ������������������  저장����������� ������������������  기술을����������� ������������������  

사용할����������� ������������������  수도����������� ������������������  있다.

<api����������� ������������������  gateway>

Page 18: Spring framework 4.x

Microservices|

<service>

<service>

<service>

!

" " "

#

%&

'

(

REST����������� ������������������  API

REST����������� ������������������  API����������� ������������������  /����������� ������������������  STOMP

message

) **

<client>

*

<service>

<database>

<database>

✓ 모든����������� ������������������  어플리케이션은����������� ������������������  한가지����������� ������������������  일만����������� ������������������  할것����������� ������������������  ✓ 목적에����������� ������������������  맞게����������� ������������������  특화����������� ������������������  시킬것����������� ������������������  ✓ 제거하기����������� ������������������  쉽도록����������� ������������������  작게����������� ������������������  만들것����������� ������������������  ✓ 웹����������� ������������������  컨테이너를����������� ������������������  내장����������� ������������������  할것����������� ������������������  ✓ 실행가능한����������� ������������������  단일����������� ������������������  jar로����������� ������������������  패키징����������� ������������������  할것����������� ������������������  ✓ 서비스들을����������� ������������������  느슨하게����������� ������������������  연결하기����������� ������������������  위해����������� ������������������  HTTP나����������� ������������������  HATEOAS를����������� ������������������  사용����������� ������������������  할것����������� ������������������  ✓ 서비스는����������� ������������������  자신의����������� ������������������  표준(metrics)을����������� ������������������  공개����������� ������������������  할것

마이크로서비스가 가져야 할 특징

<api����������� ������������������  gateway>

Page 19: Spring framework 4.x

Spring Boot|

Takes����������� ������������������  an����������� ������������������  opinionated����������� ������������������  view����������� ������������������  of����������� ������������������  building����������� ������������������  production-ready����������� ������������������  

Spring����������� ������������������  applications.����������� ������������������  Spring����������� ������������������  Boot����������� ������������������  favors����������� ������������������  convention����������� ������������������  over����������� ������������������  

configuration����������� ������������������  and����������� ������������������  is����������� ������������������  designed����������� ������������������  to����������� ������������������  get����������� ������������������  you����������� ������������������  up����������� ������������������  and����������� ������������������  running����������� ������������������  

as����������� ������������������  quickly����������� ������������������  as����������� ������������������  possible.

✓ ����������� ������������������  스프링����������� ������������������  기반����������� ������������������  애플리케이션을����������� ������������������  개발을����������� ������������������  위한����������� ������������������  빠르고,����������� ������������������  다양한����������� ������������������  입문����������� ������������������  경험을����������� ������������������  제공한다.����������� ������������������  ✓ ����������� ������������������  기본����������� ������������������  구성에서����������� ������������������  빠르게����������� ������������������  개발을����������� ������������������  시작해서,����������� ������������������  향후����������� ������������������  목적에����������� ������������������  맞춰����������� ������������������  재구성을����������� ������������������  할����������� ������������������  수����������� ������������������  있다.����������� ������������������  ✓ ����������� ������������������  내장����������� ������������������  웹����������� ������������������  컨테이너,����������� ������������������  보안,����������� ������������������  모니터링,����������� ������������������  운영����������� ������������������  환경����������� ������������������  구성����������� ������������������  등����������� ������������������  프로젝트에����������� ������������������  사용되는����������� ������������������  공통되는����������� ������������������  기능����������� ������������������  요소들을����������� ������������������  제공한다.����������� ������������������  ✓ ����������� ������������������  코드����������� ������������������  생성을����������� ������������������  하지����������� ������������������  않으며,����������� ������������������  XML����������� ������������������  설정도����������� ������������������  필요없다.

“ GOAL

Page 20: Spring framework 4.x

4.0 주요 업데이트 항목 (1 / 2)|

✓ Java����������� ������������������  SE����������� ������������������  6+����������� ������������������  (minimum����������� ������������������  API����������� ������������������  level:����������� ������������������  JDK����������� ������������������  6����������� ������������������  u18,����������� ������������������  early����������� ������������������  2010)����������� ������������������  ✓ Java����������� ������������������  EE����������� ������������������  6+����������� ������������������  (Servlet����������� ������������������  3.0����������� ������������������  focused,����������� ������������������  Servlet����������� ������������������  2.5����������� ������������������  compatible����������� ������������������  in����������� ������������������  runtime)

A new Java baseline

✓ JPA����������� ������������������  2.1,����������� ������������������  JTA����������� ������������������  1.2,����������� ������������������  JMS����������� ������������������  2.0,����������� ������������������  Bean����������� ������������������  Validation����������� ������������������  1.1,����������� ������������������  Concurrency����������� ������������������  Utilities����������� ������������������  (JSR-236����������� ������������������  )

Support for key JavaEE 7 technologies

Java 8 support

Removed Deprecated Packages and Methods✓ check����������� ������������������  out����������� ������������������  the����������� ������������������  API����������� ������������������  Differences����������� ������������������  Report

✓ Hibernate����������� ������������������  3.6+,����������� ������������������  Hibernate����������� ������������������  Validator����������� ������������������  4.3+,����������� ������������������  EhCache����������� ������������������  2.1+,����������� ������������������  Quartz����������� ������������������  1.8+,����������� ������������������  etc����������� ������������������  ✓ support����������� ������������������  for����������� ������������������  Jackson����������� ������������������  has����������� ������������������  been����������� ������������������  focused����������� ������������������  on����������� ������������������  2.0+

Support for 3rd party libraries version - minimum 2010

✓ lambda����������� ������������������  expressions����������� ������������������  &����������� ������������������  method����������� ������������������  references����������� ������������������  ✓ JSR-310����������� ������������������  Date����������� ������������������  and����������� ������������������  Time����������� ������������������  (@DateTimeFormater)����������� ������������������  ✓ repeatable����������� ������������������  annotations,����������� ������������������  parameter����������� ������������������  name����������� ������������������  discovery

Page 21: Spring framework 4.x

4.0 주요 업데이트 항목 (2 / 2)|

Groovy Bean Definition DSL

Core Container Improvements

General Web Improvements

✓ generic����������� ������������������  types����������� ������������������  as����������� ������������������  a����������� ������������������  form����������� ������������������  of����������� ������������������  qualifier����������� ������������������  ✓ meta-annotation����������� ������������������  support����������� ������������������  ✓ conditionally����������� ������������������  filtering����������� ������������������  beans����������� ������������������  ✓ cglib-based����������� ������������������  proxy����������� ������������������  classes����������� ������������������  no����������� ������������������  longer����������� ������������������  require����������� ������������������  a����������� ������������������  default����������� ������������������  constructor

✓ Creating����������� ������������������  REST����������� ������������������  Controllers����������� ������������������  with����������� ������������������  the����������� ������������������  @RestController����������� ������������������  annotation����������� ������������������  ✓ AsyncRestTemplate����������� ������������������  for����������� ������������������  developing����������� ������������������  non-blocking����������� ������������������  REST����������� ������������������  clients

WebSocket, SockJS, and STOMP Messaging✓ new����������� ������������������  spring����������� ������������������  sub-projects����������� ������������������  [spring-messaging,����������� ������������������  spring-websocket]

Testing Improvements✓ ActiveProfilesResolver����������� ������������������  API����������� ������������������  (@AcHveProfiles)����������� ������������������  ✓ Servlet����������� ������������������  API����������� ������������������  mock����������� ������������������  improvements����������� ������������������  (Servlet����������� ������������������  3.0+)

Page 22: Spring framework 4.x

2013년 1월 16일 - Next Stop: Spring Framework 4.0

2013년 12월 12일 - 4.0 Release

2014년 9월 4일 - 4.1 Release

✓ Modernization����������� ������������������  -����������� ������������������  Java����������� ������������������  8����������� ������������������  support,����������� ������������������  support����������� ������������������  for����������� ������������������  3rd����������� ������������������  party����������� ������������������  libraries����������� ������������������  latest����������� ������������������  versions����������� ������������������  ✓ Working����������� ������������������  with����������� ������������������  the����������� ������������������  JCP����������� ������������������  -����������� ������������������  spring����������� ������������������  collaborates����������� ������������������  in����������� ������������������  JCP����������� ������������������  (Java����������� ������������������  EE����������� ������������������  specifications),����������� ������������������  Java����������� ������������������  EE����������� ������������������  6����������� ������������������  and����������� ������������������  7����������� ������������������  support����������� ������������������  ✓ New����������� ������������������  application����������� ������������������  architectures����������� ������������������  -����������� ������������������  micro-service,����������� ������������������  reactive����������� ������������������  event-driven����������� ������������������  application

✓ Annotated����������� ������������������  JMS����������� ������������������  listener����������� ������������������  methods����������� ������������������  ✓ Comprehensive����������� ������������������  support����������� ������������������  for����������� ������������������  JCache����������� ������������������  (JSR-107)����������� ������������������  annotations����������� ������������������  ✓ Flexible����������� ������������������  resolution����������� ������������������  and����������� ������������������  transformation����������� ������������������  of����������� ������������������  static����������� ������������������  web����������� ������������������  resources����������� ������������������  ✓ MVC����������� ������������������  views:����������� ������������������  declarative����������� ������������������  resolution,����������� ������������������  Groovy����������� ������������������  markup����������� ������������������  templates,����������� ������������������  Jackson’s����������� ������������������  JsonView����������� ������������������  ✓ WebSocket����������� ������������������  refinements:����������� ������������������  WebSocket����������� ������������������  scope,����������� ������������������  SockJS����������� ������������������  client����������� ������������������  support,����������� ������������������  WebSocket����������� ������������������  stats����������� ������������������  ✓ Performance:����������� ������������������  SpEL����������� ������������������  compiler����������� ������������������  mode,����������� ������������������  concurrency����������� ������������������  fine-tuning����������� ������������������  across����������� ������������������  the����������� ������������������  container

✓ First-class����������� ������������������  support����������� ������������������  for����������� ������������������  Java����������� ������������������  SE����������� ������������������  8����������� ������������������  based����������� ������������������  Spring����������� ������������������  applications����������� ������������������  ✓ Configuring����������� ������������������  and����������� ������������������  implementing����������� ������������������  Spring-style����������� ������������������  applications����������� ������������������  using����������� ������������������  Groovy����������� ������������������  2����������� ������������������  ✓ Support����������� ������������������  for����������� ������������������  key����������� ������������������  Java����������� ������������������  EE����������� ������������������  7����������� ������������������  technologies����������� ������������������  ✓ Enabling����������� ������������������  WebSocket-style����������� ������������������  application����������� ������������������  architectures����������� ������������������  ✓ Fine-grained����������� ������������������  eventing����������� ������������������  and����������� ������������������  messaging����������� ������������������  within����������� ������������������  the����������� ������������������  application����������� ������������������  ✓ Pruning����������� ������������������  and����������� ������������������  dependency����������� ������������������  upgrades

Page 23: Spring framework 4.x

4.1 주요 업데이트 항목|

✓ Annotated����������� ������������������  JMS����������� ������������������  listener����������� ������������������  methods����������� ������������������  (@JmsListener)

JMS Improvements

Web Improvements✓ new����������� ������������������  static����������� ������������������  resource����������� ������������������  handling����������� ������������������  ✓ intercepting����������� ������������������  requests����������� ������������������  with����������� ������������������  @ResponseBody����������� ������������������  and����������� ������������������  ResponseEntity����������� ������������������  ✓ new����������� ������������������  HttpMessageConverter����������� ������������������  options����������� ������������������  (GSON,����������� ������������������  Google����������� ������������������  Protocol����������� ������������������  Buffers ,����������� ������������������  etc.)

✓ SockJS����������� ������������������  (Java)����������� ������������������  client-side����������� ������������������  support����������� ������������������  ✓ new����������� ������������������  application����������� ������������������  events����������� ������������������  SessionSubscribeEvent,����������� ������������������  SessionUnsubscribeEvent

WebSocket STOMP Messaging Improvements

✓ Declarative����������� ������������������  configuration����������� ������������������  for����������� ������������������  test����������� ������������������  property����������� ������������������  sources����������� ������������������  (@TestPropertySource)����������� ������������������  ✓ Declarative����������� ������������������  SQL����������� ������������������  script����������� ������������������  execution����������� ������������������  (@Sql,����������� ������������������  @SqlConfig,����������� ������������������  @SqlGroup)

Testing Improvements

Support for JCache(JSR-107) annotations

Page 24: Spring framework 4.x

2013년 1월 16일 - Next Stop: Spring Framework 4.0

2013년 12월 12일 - 4.0 Release

2014년 9월 4일 - 4.1 Release

2015년 7월 15일 - 4.2 Release !?

✓ Annotated����������� ������������������  JMS����������� ������������������  listener����������� ������������������  methods����������� ������������������  ✓ Comprehensive����������� ������������������  support����������� ������������������  for����������� ������������������  JCache����������� ������������������  (JSR-107)����������� ������������������  annotations����������� ������������������  ✓ Flexible����������� ������������������  resolution����������� ������������������  and����������� ������������������  transformation����������� ������������������  of����������� ������������������  static����������� ������������������  web����������� ������������������  resources����������� ������������������  ✓ MVC����������� ������������������  views:����������� ������������������  declarative����������� ������������������  resolution,����������� ������������������  Groovy����������� ������������������  markup����������� ������������������  templates,����������� ������������������  Jackson’s����������� ������������������  JsonView����������� ������������������  ✓ WebSocket����������� ������������������  refinements:����������� ������������������  WebSocket����������� ������������������  scope,����������� ������������������  SockJS����������� ������������������  client����������� ������������������  support,����������� ������������������  WebSocket����������� ������������������  stats����������� ������������������  ✓ Performance:����������� ������������������  SpEL����������� ������������������  compiler����������� ������������������  mode,����������� ������������������  concurrency����������� ������������������  fine-tuning����������� ������������������  across����������� ������������������  the����������� ������������������  container

✓ Modernization����������� ������������������  -����������� ������������������  Java����������� ������������������  8����������� ������������������  support,����������� ������������������  support����������� ������������������  for����������� ������������������  3rd����������� ������������������  party����������� ������������������  libraries����������� ������������������  latest����������� ������������������  versions����������� ������������������  ✓ Working����������� ������������������  with����������� ������������������  the����������� ������������������  JCP����������� ������������������  -����������� ������������������  spring����������� ������������������  collaborates����������� ������������������  in����������� ������������������  JCP����������� ������������������  (Java����������� ������������������  EE����������� ������������������  specifications),����������� ������������������  Java����������� ������������������  EE����������� ������������������  6����������� ������������������  and����������� ������������������  7����������� ������������������  support����������� ������������������  ✓ New����������� ������������������  application����������� ������������������  architectures����������� ������������������  -����������� ������������������  micro-service,����������� ������������������  reactive����������� ������������������  event-driven����������� ������������������  application

✓ First-class����������� ������������������  support����������� ������������������  for����������� ������������������  Java����������� ������������������  SE����������� ������������������  8����������� ������������������  based����������� ������������������  Spring����������� ������������������  applications����������� ������������������  ✓ Configuring����������� ������������������  and����������� ������������������  implementing����������� ������������������  Spring-style����������� ������������������  applications����������� ������������������  using����������� ������������������  Groovy����������� ������������������  2����������� ������������������  ✓ Support����������� ������������������  for����������� ������������������  key����������� ������������������  Java����������� ������������������  EE����������� ������������������  7����������� ������������������  technologies����������� ������������������  ✓ Enabling����������� ������������������  WebSocket-style����������� ������������������  application����������� ������������������  architectures����������� ������������������  ✓ Fine-grained����������� ������������������  eventing����������� ������������������  and����������� ������������������  messaging����������� ������������������  within����������� ������������������  the����������� ������������������  application����������� ������������������  ✓ Pruning����������� ������������������  and����������� ������������������  dependency����������� ������������������  upgrades

Page 25: Spring framework 4.x

Spring I/O 2015 | The conference|

✓ Annotated����������� ������������������  Event����������� ������������������  Listeners����������� ������������������  (@EventListener,����������� ������������������  @TransactionalEventListener)

Better application events

Support for JSR-354 Money & Currency

Http Streaming✓ New����������� ������������������  return����������� ������������������  type����������� ������������������  ResponseBodyEmitter����������� ������������������  ✓ Server-Sent����������� ������������������  Events(SSE,����������� ������������������  HTML5)����������� ������������������  support

CORS Support (@CrossOrigin)

Page 26: Spring framework 4.x

。fl゚(*´□`)fl゚。넋두리

억울하거나 불만스러운 일 따위가 마음속에 있을 때 하소연하듯 길게 늘어놓는 말

Page 27: Spring framework 4.x

SPRING 4.X & Java 8|

✓ JdbcTemplate����������� ������������������  (PreparedStatementSetter,����������� ������������������  RowMapper)����������� ������������������  ✓ TransactionTemplate����������� ������������������  (TransactionCallback)����������� ������������������  ✓ JmsTemplate����������� ������������������  (MessageCreator)

Lambdas-ready Callback interfaces in Templates

JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); jdbcTemplate.query( "SELECT ID, NAME, RANK FROM PLAYER WHERE RANK < ?", ps -> { ps.setInt(1, 10); }, (rs, rowNum) -> { return new Player(rs.getLong("ID"), rs.getString("NAME"), rs.getInt("RANK")); } );

Lambdas with JdbcTemplate

Page 28: Spring framework 4.x

SPRING 4.X & Java 8|

Repeatable annotations@Configuration@PropertySources({ @PropertySource("facebook.properties"), @PropertySource("twitter.properties") }) class SocialConfiguration { .. }@Configuration@PropertySource("facebook.properties") @PropertySource("twitter.properties") class RepeatableSocialConfiguration { .. }

java.util.Optional<T> : Controller handler parameters@RequestMapping("/required")String required(@RequestParam(required = false, defaultValue = "") String value) { return value; } @RequestMapping("/optional")String optional(@RequestParam Optional<String> value) { return value.orElse(""); }

Java 7+

Java 8+

Page 29: Spring framework 4.x

SPRING 4.X & Java 8|

Declarative Formatting with Java 8 Date-Timeimport java.time.*; import javax.validation.constraints.*; import org.springframework.format.annotation.*; public class Customer { @DateTimeFormat(iso=ISO.DATE) private LocalDate birthDate; @DateTimeFormat(pattern="M/d/yy h:mm") @NotNull @Past private LocalDateTime lastContact; }

Declarative Formatting with JSR-354 Money & Currency [4.2]import javax.money.*; import org.springframework.format.annotation.*; public class Product { @NumberFormat private MonetaryAmount basePrice; @NumberFormat(style = NumberFormat.Style.CURRENCY) private MonetaryAmount netPrice; }

Page 30: Spring framework 4.x

Spring Core|

Generic @Autowiredpublic interface PlayerRepository extends Repository<Player, Long> { .. }

@Servicepublic class PlayerService { @Autowired private PlayerRepository playerRepository; @Autowired private Repository<Player, Long> genericPlayerRepository; }

meta-annotation@Target({ ElementType.TYPE })@Retention(RetentionPolicy.RUNTIME) @Documented@RestController@RequestMapping(value = "/1.0/", params = { "accessToken" })@Transactionalpublic @interface Ver10RestController { Isolation isolation() default Isolation.DEFAULT; } @Ver10RestController(isolation = Isolation.REPEATABLE_READ) public static class PlayerController { .. }

value() 속성을 제외한 기타 속성은 재정의 가능+

Page 31: Spring framework 4.x

Spring Core|

Groovy Bean Definition DSLimport org.springframework.web.servlet.view.InternalResourceViewResolverimport org.springframework.web.servlet.view.JstlViewbeans { xmlns context: 'http://www.springframework.org/schema/context' xmlns mvc: 'http://www.springframework.org/schema/mvc' context.'component-scan'('base-package': 'jco.conference.oxquiz') mvc.'annotation-driven'() mvc.'default-servlet-handler'() mvc.'resources'('mapping': '/resources/**', 'location': '/resources/') jstlViewResolver(InternalResourceViewResolver) { viewClass = JstlView prefix = '/WEB-INF/views' suffix = '.jsp' } }

Page 32: Spring framework 4.x

Spring Core|

Annotated JMS Endpoints@JmsListener(destination="order") public OrderStatus processOrder(Sort.Order order) { // do something} @JmsListener(id="orderListener", containerFactory=“myJmsFactory" , destination="order", selector="type='sell'") @SendTo("orderStatus") public OrderStatus processOrder(Sort.Order order, @Header String type) { // do something}

Annotated Event Listeners [4.2]@EventListenerpublic void processEvent(String payload) { // do something} @EventListener(condition="#payload.startsWith('OK')") public void processEvent(String payload) { // do something}

Page 33: Spring framework 4.x

Spring Core|

JCache (JSR-107) Supportimport javax.cache.annotation.*; @CacheDefaults(cacheName="orders") public class OrderRepository { @CacheResult public Order findById(String id) { } @CachePut public void updateOrder(String id, @CacheValue Order book) { } @CacheRemove public void delete(String id) { }}

Page 34: Spring framework 4.x

Spring Web|

handling static web resourcesclass WebConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/**") .addResourceLocations("classpath:public/") .resourceChain(true) .addResolver(new GzipResourceResolver()) .addResolver(new VersionResourceResolver().addContentVersionStrategy("/**")) .addTransformer(new CssLinkResourceTransformer()); } @Bean public ResourceUrlEncodingFilter resourceUrlEncodingFilter() { return new ResourceUrlEncodingFilter(); } }

/* JSP */ <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%><link rel='stylesheet' type='text/css' href='<spring:url value="/css/default.css"/>'> <script src="<spring:url value="/js/app.js"/>"></script>

/css/default-c847040f6a5a67d9556811064e228477.css

,

Page 35: Spring framework 4.x

Spring Web|

Using AsyncRestTemplateAsyncRestTemplate asyncRestTemplate = new AsyncRestTemplate();

ListenableFuture<ResponseEntity<Repository[]>> listenableFuture = asyncRestTemplate.getForEntity(GITHUB_API, Repository[].class, uriVariables); reposForEntity.addCallback(response -> { // 성공}, thrown -> { // 실패});

intercepting @ResponseBody and ResponseEntity handlers@ControllerAdviceclass JsonpResponseBodyAdvice extends AbstractJsonpResponseBodyAdvice { public JsonpResponseBodyAdvice() { super("callback"); } }

ResponseBodyAdvice<T> <interface>

http://springcamp.io/api/sessions?callback=renderSessions

Page 36: Spring framework 4.x

Spring Web|

Stomp on WebSocket@Controllerpublic class StompController { @SubscribeMapping("/positions") public List<PortfolioPosition> getPortfolios(Principal user) { // do something } @MessageMapping("/trade") public void executeTrade(Trade trade, Principal user) { // do something } }

HTTP Streaming - Server-Sent Events [4.2]@RequestMappingpublic SseEmitter handlerSSE() { SseEmitter emitter = new SseEmitter(); return emitter; }

// Later from some other threademitter.send(new Event("noti.newMail)", data)); emitter.send(new Event("noti.update)", data)); emitter.complete();

Page 37: Spring framework 4.x

Spring Test|

@ActiveProfiles – Declarative@ContextConfiguration@ActiveProfiles("dev") public class IntegrationTests { // ...}

Test Property Sources@ContextConfiguration@TestPropertySource( locations = { "/test.properties" }, properties = { "database: h2", "port: 4242" } ) public class IntegrationTests { // ...}

Page 38: Spring framework 4.x

Spring Test|

Executing SQL per Test Method@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration@Sql({ "schema1.sql", "data1.sql" })public class SqlScriptsTests { @Test public void classLevelScripts() { /* ... */ } @Test @Sql({"schema2.sql", "data2.sql"}) public void methodLevelScripts() { /* ... */ } }

Page 39: Spring framework 4.x

Spring Test|

TestTransaction API@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration@Transactionalpublic class TransactionalTests { @Test @Sql({ "init-user-table.sql" }) public void withinTransaction() { // assert initial state in test database assertNumUsers(2); deleteFromTables("user"); // changes to the database will be committed TestTransaction.flagForCommit(); TestTransaction.end(); assertFalse(TestTransaction.isActive()); assertNumUsers(0); TestTransaction.start(); // perform other actions against the database that // will be automatically rolled back after the test // completes... } }

Page 40: Spring framework 4.x

더 많은 것들이 있지만...

Page 41: Spring framework 4.x

궁금하신분!?

Page 42: Spring framework 4.x

한국 스프링 사용자 그룹 (KSUG)

https://www.facebook.com/groups/springkorea/

http://groups.google.com/group/ksug

http://www.ksug.org/

Page 43: Spring framework 4.x

고맙습니다!

Page 44: Spring framework 4.x

참고자료|

‣����������� ������������������  Spring����������� ������������������  Framework����������� ������������������  Reference����������� ������������������  ‣����������� ������������������  Modern����������� ������������������  Java����������� ������������������  Component����������� ������������������  Design����������� ������������������  with����������� ������������������  Spring����������� ������������������  Framework����������� ������������������  4.2����������� ������������������  ‣����������� ������������������  Spring����������� ������������������  4����������� ������������������  Web����������� ������������������  Application����������� ������������������  ‣����������� ������������������  Testing����������� ������������������  with����������� ������������������  Spring����������� ������������������  4.X����������� ������������������  ‣����������� ������������������  SPRING����������� ������������������  FRAMEWORK����������� ������������������  4.X����������� ������������������  ‣����������� ������������������  Chat����������� ������������������  application����������� ������������������  using����������� ������������������  Spring����������� ������������������  WebSockets


Recommended