Spring I/O 2015報告会
2015/6/22 JSUG
2015/6/22 JSUG
内容 | 時間 | 発表者 |
---|---|---|
概要 | 5min | 池谷 |
Key Note 「Springの歴史」 | 10min | 本橋 |
セッションサマリ(Spring 4.2) | 45min | 岩塚、池谷 |
セッションサマリ(その他) | 20min | 岩塚、池谷 |
内容 | 時間 | 発表者 |
---|---|---|
概要 | 5min | 池谷 |
Key Note 「Springの歴史」 | 10min | 本橋 |
セッションサマリ(Spring 4.2) | 45min | 岩塚、池谷 |
セッションサマリ(その他) | 20min | 岩塚、池谷 |
タイトル | カテゴリ | スピーカー | 報告者 |
---|---|---|---|
Modern Java Component Design with Spring 4.2 | Core | Juergen Hoeller | 池谷 |
Spring 4 Web Apps | Web | Rossen Stoyanchev | 岩塚 |
Real-time with Spring: SSE and WebSockets | Web | Sergi Almar | 岩塚 |
Testing with Spring 4.x | Test | Sam Brannen | 岩塚 |
分類 | 新機能 |
---|---|
Web | 静的リソース制御の改善 |
Controller引数のOptionalサポート | |
Controllerの返値のListenableFuture サポート |
|
Jacksonの@JsonView サポート |
|
JSONPサポート | |
ResponseBodyAdvice 追加 |
|
新しいHttpMessageConverter 追加 |
|
EL関数s:mvcUrl 追加 |
|
ResponseEntity ビルダーサポート |
|
GroovyMarkupTemplate サポート |
分類 | 新機能 |
---|---|
JMS | @JmsListener サポート |
spring-messaging サポート |
|
Cache | JCache(JSR-107)サポート |
WebSocket | SockJSのクライアントサイドサポート |
STOMPのSubscribeイベントサポート | |
websocketスコープの追加 | |
Test | Groovy ScriptでのTestContext設定サポート |
@Sql /@SqlConfig のサポート |
|
@TestPropertySource のサポート |
詳細は、 http://www.slideshare.net/makingx/springone-2gx-2014-spring-41-jsug
4.1新機能 | 4.2新機能 |
---|---|
Web JMS WebSocket Test Cache |
Web JMS WebSocket Test Container Data Access |
分類 | 新機能 | 詳細 |
---|---|---|
Container | @Bean のJava8 defaultメソッド対応 |
○ |
@Import の改善 |
○ | |
@Order のConfigurationクラス対応 |
- | |
@Resource の@Lazy 対応 |
- | |
@EventListener によるイベント検知 |
○ | |
ApplicationEvent を継承しないイベント |
○ | |
@AliasFor による@属性のエイリアス対応 |
○ |
分類 | 新機能 | 詳細 |
---|---|---|
DefaultConversionService の改善 |
- | |
DefaultFormattingConversionService のJSR-354 Money & Currency対応 |
- | |
@NumberFormat のmeta-annotation対応 |
- | |
JavaMailSenderImpl へのtestConnection() メソッド追加 |
- | |
ScheduledTaskRegistrar の改善 |
- | |
Apache commons-pool2 のサポート |
- |
@Bean
のJava8 defaultメソッド対応@Bean
のJava8 defaultメソッド対応(Before)Java-Based ConfigurationのBean定義
@Configuration
@Import({MyBookAdminConfig.class, MyBookConfig.class})
public class MyApplicationConfig { ... }
@Configuration
public class MyBookAdminConfig {
@Bean
public BookAdminService myBookAdminService() {
MyBookAdminService service = new MyBookAdminService();
service.setDataSource(bookAdminDataSource());
return service;
}
}
@Bean
のJava8 defaultメソッド対応(After)継承するので、必要に応じて生成Beanを@Override
できる。
@Configuration
public class MyApplicationConfig
implements MyBookAdminConfig, MyBookConfig { ... }
public interface MyBookAdminConfig {
@Bean
default BookAdminService myBookAdminService() {
MyBookAdminService service = new MyBookAdminService();
service.setDataSource(bookAdminDataSource());
return service;
}
}
@EventListener
周りの改善@EventListener
(Before)ApplicationListener
を実装ApplicationEvent
を継承public class MyApplicationEvent extends ApplicationEvent {...}
public class MyApplicationEventPublisher
implements ApplicationEventPublisherAware {
...
public void publishMyApplicationEvent() {
publisher.publishEvent(new MyApplicationEvent());
}
}
public class MyApplicationEventListener
implements ApplicationListener<MyApplicationEvent> {
public void onApplicationEvent(MyApplicationEvent event) { ... }
}
@EventListener
(After)condition
属性のSpELでフィルタ@EventListener
public void processEvent(MyApplicationEvent event) {
...
}
@EventListener
public void processEvent(String payload) {
// ApplicationEventを継承しない任意オブジェクトイベント
...
}
@EventListener(condition="#payload.startsWith('OK')")
public void processEvent(String payload) {
...
}
ApplicationEvent
を継承しないイベント@EventListener
を使用すると、ApplicationEvent
を継承しない任意オブジェクトのイベントをスマートに発行、検知。PayloadApplicationEvent
にラップされるので、従来のListenerインタフェースでも検知可能。public class MyApplicationEventPublisher
implements ApplicationEventPublisherAware {
...
public void publishMyApplicationEvent() {
publisher.publishEvent("Hello World.");
}
}
@TransactionalEventListener
のサポートイベント発行即時でなく、イベント発行側のトランザクション終了前後でイベントを検知できる。
@TransactionalEventListener()
public void afterCommit(MyApplicationEvent event) {
...
}
@TransactionalEventListener(phase=TransactionPhase.BEFORE_COMMIT)
public void beforeCommit(MyApplicationEvent event) {
...
}
@TransactionalEventListener(fallbackExecution = true)
public void afterCommitFallbackExecution(MyApplicationEvent event) {
// トランザクション外でイベントが発行された場合も呼び出される
...
}
https://spring.io/blog/2015/02/11/better-application-events-in-spring-framework-4-2
@Service
@Scope("session")
@Primary
@Transactional(rollbackFor=Exception.class)
@Retention(RetentionPolicy.RUNTIME)
public @interface MyService {}
@MyService
public class MyBookAdminService { ... }
@AliasFor
エイリアス対応(Before)value
属性は上書けない@Service
@Scope("session")
@Primary
@Transactional(rollbackFor=Exception.class)
@Retention(RetentionPolicy.RUNTIME)
public @interface MyService {
boolean readOnly();
}
@AliasFor
エイリアス対応(After)単一アノテーション内での利用
public @interface ContextConfiguration {
@AliasFor(attribute = "locations")
String[] value() default {};
@AliasFor(attribute = "value")
String[] locations() default {};
}
@AliasFor
による@属性のエイリアス対応(After)メタアノテーション内のエイリアスの利用
value
属性の上書@Service
@Scope("session")
@Primary
@Transactional(rollbackFor=Exception.class)
@Retention(RetentionPolicy.RUNTIME)
public @interface MyService {
@AliasFor(annotation = Service.class, attribute = "value")
String value() default "";
@AliasFor(annotation = Transactional.class, attribute = "readOnly")
boolean myReadOnly();
}
@Import
の改善@Import
でComponentクラスをインポートできるようになった。
@ComponentScan
や@Component
なしでBeanを生成できる。
@Configuration
@Import(MyBookAdminService.class)
public class MyApplicationConfig {
...
}
public class MyBookAdminService implements BookAdminService {
@Autowired
public MyBookAdminService(AccountRepository repo) {
...
}
}
カテゴリ | 新機能 | 詳細 |
---|---|---|
Data Access | AspectJによるjavax.transaction.Transactional の対応 |
- |
SimpleJdbcCallOperations の名前バインディング対応 |
- | |
Hibernate ORM 5.0のフルサポート | - | |
<jdbc:embedded-database> へのdatabase-name 属性追加 |
- | |
JMS | 省略 | - |
別資料へ
タイトル | スピーカー |
---|---|
Spring Boot is made for tooling | Yann Cébron & Stéphane Nicoll |
Spring Batch for Large Enterprises Operations | Ignasi González |
TERASOLUNA Framework on the Spring IO Platform | 槙さん |
Manage your user’s session with Spring Session | David Gomez |
High Performance Spring Integration | John Davies |
タイトル | スピーカー |
---|---|
Spring Data REST – Repositories meet hypermedia | Oliver Gierke |
Building High Performance Applications with Spring Data Neo4j 4.0 | Michael Hunger & Vince Bickers |
Document like the Spring team using Asciidoctor | Alex Soto |
A Brief History of Thymeleaf | Jose Samper |
JHipster, the leading application generator for Spring Boot + AngularJS | Julien Dubois |
Ignasi Gonzalez
Toshiaki Maki
David Gomez
HttpSession
やHttpRequest
をラップし、Spring Session管理のセッションに透過的に置き換える。MultiHttpSessionStrategy
)x-auth-token
)
http://www.slideshare.net/dgomezg/managing-users-data-with-spring-session
Jose Samper
繰り返し処理の記述例
<ul>
<li th:each="product : ${products}"
th:text="${product.name}">
Red carpet
</li>
</ul>
Yann Cébron Stéphane Nicoll