SlideShare una empresa de Scribd logo
1 de 73
Descargar para leer sin conexión
Spring Framework 4.1
Sam Brannen
@sam_brannen
Sam Brannen
•  Spring and Java Consultant @ Swiftmind
•  Java Developer for over 15 years
•  Spring Framework Core Committer since 2007
•  Component lead for spring-test
•  Spring Trainer
•  Speaker on Spring, Java, and testing
•  Swiss Spring User Group Lead
2
Areas of expertise
–  Spring *
–  Java EE
–  Software Architecture
–  Software Engineering Best
Practices
Where you find us
•  Zurich, Switzerland
•  @swiftmind
•  http://www.swiftmind.com
3
Your experts for Spring & Enterprise Java
A show of hands…
4
?
?
?
?
?
?
Agenda
•  Container enhancements
•  Caching
•  JMS
•  Spring MVC
•  Testing
•  Q&A
5
Container Enhancements
6
Enhancements in 4.1
•  java.util.Optional
•  Dependency injection
•  MVC method arguments
•  @Order on @Bean methods
•  Injecting ordered lists
•  @Priority (javax.annotation)
•  Ordering
•  Primary candidate selection
•  SpEL compiler
•  Modes: off, immediate, mixed
•  System / Spring property: spring.expression.compiler.mode
7
Injection point with required flag
@Service
public class MyService {
@Autowired(required=false)
NotificationService notificationService;
public Book findBook(long id) {
if (notificationService != null) { /* ... */ }
}
}
8
before
Injection point with java.util.Optional
@Service
public class MyService {
@Autowired
Optional<NotificationService> notificationService;
public Book findBook(long id) {
notificationService.ifPresent(service -> /* ... */ );
}
}
9
after
@Order on Components (4.0)
@Service @Order(1)
public class ServiceA implements MyService { /* ... */ }
@Service @Order(2)
public class ServiceB implements MyService { /* ... */ }
@Autowired
List<MyService> myServices;
10
ServiceA is 1st
@Order on @Bean Methods (4.1)
@Bean @Order(1)
public MyService serviceA() { return new ServiceA(); }
@Bean @Order(2)
public MyService serviceB() { return new ServiceB(); }
@Autowired
List<MyService> myServices;
11
ServiceA is 1st
Caching
12
New Caching Features
•  @CacheConfig
•  common class-level configuration
•  CacheResolver
•  fine grained, programmatic cache resolution
•  JCache (JSR-107)
•  New putIfAbsent() method in Cache API
13
Review: Spring Caching API
14
“books” cache name is
duplicated everywhere. L
@CacheConfig
15
“books” cache name is
declared only once! J
CacheResolver API
16
•  getOperation()
•  getTarget()
•  getMethod()
•  getArgs()
JCache (JSR 107) and Spring
•  JCache 1.0 annotations now supported in Spring
•  Integration based on Spring’s own Cache and CacheManager APIs
•  JCacheCache and JCacheCacheManager
•  Enabled via Spring’s standard mechanisms:
•  XML: <cache:annotation-driven />
•  Java: @EnableCaching
•  Cache Abstraction: JCache (JSR-107) Annotations Support
•  https://spring.io/blog/2014/04/14/cache-abstraction-jcache-jsr-107-annotations-support
17
JCache Annotations Support
18
Caching Annotations Comparison
19
Spring JCache
@Cacheable @CacheResult
@CachePut @CachePut
@CacheEvict @CacheRemove
@CacheEvict(allEntries=true) @CacheRemoveAll
JMS
20
JMS Overhaul
•  Alignment with spring-messaging module
•  Annotation-driven endpoints
•  Analogous to <jms:listener-container />
•  Listener methods declared via @JmsListener
•  Configured via:
o  XML: <jms:annotation-driven />
o  Java: @EnableJms and JmsListenerConfigurer
21
Review: Spring JMS Config in XML
22
Annotated JMS Endpoints
23
Flexible Method Signatures
24
Transition from existing XML config…
25
… or remove XML altogether
26
Spring MVC
27
ResponseBodyAdvice
•  Callback for @ResponseBody / ResponseEntity methods
•  just before the response is written (and committed)
•  you can still modify headers
•  or the object to be written to the response
•  Two implementations already
•  JsonViewResponseBodyAdvice
•  AbstractJsonpResponseBodyAdvice
28
Jackson @JsonView Support
interface PublicView {}
class User {
@JsonView(PublicView.class)
String username;
String password;
// ...
}
29
@RestController
class UserController {
@RequestMapping("/user")
@JsonView(PublicView.class)
public User getUser() {
return new User("eric",
"7!#H2");
}
}
JSONP Support
•  Simply declare as a Spring-managed component…
@ControllerAdvice
class JsonpAdvice extends AbstractJsonpResponseBodyAdvice {
public JsonpAdvice() {
super("callback");
}
}
30
Name of JSONP
query param(s)
HttpMessageConverter Additions
•  Gson
•  lighter footprint (vs Jackson); used in Spring Android
•  Google Protocol Buffers
•  effective inter-service communication data protocol
•  Jackson / XML
•  just add jackson-dataformat-xml to the classpath
31
Static Resource Handling in Web MVC
•  ResourceTransformer API
•  Transforms the content of a resource
•  ResourceResolver API for resolving:
•  Internal static resources
•  External resource paths (i.e., links)
•  ResourceResolverChain
•  Maintains a chain of resolvers
•  Allowing for delegation
•  Configured via ResourceHandlerRegistry
•  For example, via WebMvcConfigurationSupport
32
ResourceResolver Implementations
•  PathResourceResolver
•  simple path lookup under configured locations
•  VersionResourceResolver
•  resolution with version in URL path
•  GzipResourceResolver
•  lookup with .gz extension when “Accept-Encoding: gzip”
•  CachingResourceResolver
•  caching of resolved resource
33
ResourceTransformer Implementations
•  CssLinkResourceTransformer
•  update links in CSS file (e.g. insert version)
•  AppCacheManifestTransformer
•  update links in HTML5 AppCache manifest
•  insert comment with content-based hash
•  CachingResourceTransformer
•  caching of transformed resource
34
Ex: Fingerprinting URLs w/ content-based version
boolean useResourceCache = !this.environment.acceptsProfiles("dev");
VersionResourceResolver resolver = new VersionResourceResolver();
resolver.addContentVersionStrategy("/**");
registry.addResourceHandler("/**").addResourceLocations(locations)
.resourceChain(useResourceCache).addResolver(resolver);
Example URL: “/css/font-awesome.min-7fbe76cdac.css”
35
Additional New Features in Spring MVC
•  Groovy markup templates
•  Declarative MVC view resolution
•  Enhanced view controllers
•  Linking to @RequestMapping methods
•  See HandlerMethodMappingNamingStrategy
•  ListenableFuture return type for handler methods
•  ResponseEntity Builder API
•  RequestEntity & RestTemplate.exchange()
36
Testing
37
Bootstrap Strategy & TestExecutionListeners
•  TestContext bootstrap strategy
•  TestContextBootstrapper & @BootstrapWith
•  Automatic discovery of default TestExecutionListeners
•  Uses SpringFactoriesLoader
•  Already used by Spring Security
•  Merging custom TestExecutionListeners with defaults
•  @TestExecutionListeners(mergeMode=MERGE_WITH_DEFAULTS)
•  Defaults to REPLACE_DEFAULTS
38
Spring MVC Test
•  Assert JSON responses with JSON Assert
•  Complements JSONPath support
•  Create MockMvcBuilder recipes with MockMvcConfigurer
•  Developed to apply Spring Security setup but can be used by anyone
•  AsyncRestTemplate support in MockRestServiceServer
•  For asynchronous client-side testing
39
Groovy Beans in Spring
•  Spring Framework 4.0 introduced support for the Groovy Bean
Definition DSL via the GroovyBeanDefinitionReader and
GenericGroovyApplicationContext
•  Spring Framework 4.1 introduces support for Groovy scripts in
web applications via the GroovyWebApplicationContext
•  Testing support added in 4.1…
40
Groovy Scripts for Context Config in Tests
•  Spring Framework 4.1 introduces support for Groovy scripts in
integration tests via @ContextConfiguration
•  Scripts are configured via the locations or value attribute
o  Resource semantics identical to XML
o  Default detected with “Context.groovy” suffix in same package
•  The inheritLocations flag is fully supported
•  Groovy and XML configuration can be declared together
•  Groovy WebApplicationContexts supported via
@WebAppConfiguration
41
Ex: Groovy Script Config
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/context.groovy")
public class GroovyPersonTests {
@Autowired
private Person person;
/* test methods using person bean */
}
42
Ex: Default Groovy Script Detection
public com.example;
@RunWith(SpringJUnit4ClassRunner.class)
// ApplicationContext will be loaded from
// “classpath:com/example/MyTestContext.groovy”
@ContextConfiguration
public class MyTest {
/* ... */
}
43
Ex: Groovy & XML Config Together
@RunWith(SpringJUnit4ClassRunner.class)
// ApplicationContext will be loaded from
// “/context.groovy” and “/context.xml”
@ContextConfiguration({ "/context.groovy", "/context.xml" })
public class MyTest {
/* ... */
}
44
Test Property Sources
•  Spring 3.1 introduced PropertySources abstraction
•  Configured via Environment or via @PropertySource
•  Spring 4.1 supports declarative test property sources
•  Configured via @TestPropertySource
•  Test property sources are declared via annotation attributes
•  locations or value: resource locations
•  properties: inlined properties
•  both are inherited by default
45
@TestPropertySource – locations
•  String array of resource locations for Java Properties files
•  Both traditional *.properties and XML formats are supported
•  Resource semantics are identical to those for locations in
@ContextConfiguration
46
Ex: @TestPropertySource – locations
@ContextConfiguration
@TestPropertySource("/test.properties")
public class MyIntegrationTests {
// class body...
}
47
@TestPropertySource – properties
•  Inlined properties can be declared as key/value pairs
•  Uses syntax for entries in Java properties files:
•  "key=value"
•  "key:value"
•  "key value"
48
Ex: @TestPropertySource – properties
@ContextConfiguration
@TestPropertySource(
properties = {"foo=bar", "port: 4242"}
)
public class MyIntegrationTests {
// class body...
}
49
Default Properties File Detection
•  If neither locations nor properties are defined, a default properties
file will be detected
•  Default is detected with “.properties” suffix in same package
•  If the class is com.example.MyTest, the default properties file is
“classpath:com/example/MyTest.properties”
•  Exception is thrown if default is not present
50
@TestPropertySource – Precedence
51
Inlined
Files
Application & System
test
precedence
Ex: @TestPropertySource – locations & properties
@ContextConfiguration
@TestPropertySource(
locations = "/test.properties",
properties = "port: 4242"
)
public class MyIntegrationTests {
// class body...
}
52
Programmatic Transaction Management in Tests
•  History Lesson: Spring’s JUnit 3.8 testing framework supported
endTransaction() and startNewTransaction() methods in
AbstractTransactionalSpringContextTests
•  But… the Spring TestContext Framework, introduced in Spring
2.5, did not… until now
•  Due to popular demand, Spring 4.1 introduces a new
TestTransaction API
53
Transactions in Spring
•  Spring-managed transactions: managed by Spring in the
ApplicationContext
•  @Transactional and AOP
•  Application-managed transactions: managed programmatically within
application code
•  TransactionTemplate and TransactionSynchronizationManager
•  Test-managed transactions: managed by the Spring TestContext
Framework
•  @Transactional on test classes and test methods
•  Transaction is rolled back by default!
54
Ex: Declarative Transaction Management in Tests
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@Transactional
public class TransactionalTests {
@Test
public void withinTransaction() {
/* ... */
}
55
What if we want to
stop & start the
transaction within the
test method?
TestTransaction API
•  Static methods for interacting with test-managed transactions
•  isActive()
•  isFlaggedForRollback()
•  flagForCommit()
•  flagForRollback()
•  end()
•  start()
56
query status
change default rollback setting
end: roll back or commit based on flag
start: new tx with default rollback setting
Ex: Programmatic Tx Management in Tests
@Test
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...
}
57
Executing SQL Scripts
58
Ex: Embedded Database in Java Config
59
@Bean
public DataSource dataSource() {
return new EmbeddedDatabaseBuilder()
.setType(H2)
.setScriptEncoding("UTF-8")
.ignoreFailedDrops(true)
.addScript("schema.sql")
.addScripts("user_data.sql", "country_data.sql")
.build();
}
API greatly improved
in Spring 4.0.3
Ex: Embedded Database in XML Config
<jdbc:embedded-database id="dataSource" type="H2">
<jdbc:script location="classpath:/schema.sql" />
<jdbc:script location="classpath:/user_data.sql" />
</jdbc:embedded-database>
60
Ex: Populate Database in XML Config
<jdbc:initialize-database data-source="dataSource">
<jdbc:script location="classpath:/schema_01.sql" />
<jdbc:script location="classpath:/schema_02.sql" />
<jdbc:script location="classpath:/data_01.sql" />
<jdbc:script location="classpath:/data_02.sql" />
</jdbc:initialize-database>
61
Executing SQL per Test Method
•  The previous techniques are very useful for setting up the initial
database state
•  Q: But how can we execute SQL scripts per test method?
•  A: Programmatically via ScriptUtils,
ResourceDatabasePopulator, or abstract transactional base test
classes for JUnit and TestNG.
•  Q: OK, but how can we do that declaratively?
•  A: Via @Sql in Spring Framework 4.1!
62
Executing SQL Scripts Declaratively with @Sql
•  @Sql: declared on a test class or test method
•  method-level overrides class-level
•  The scripts attribute is used to declare resource locations for
SQL scripts
•  semantics analogous to locations in @ContextConfiguration
•  Scripts can be executed before or after a test method
•  configured via the executionPhase attribute of @Sql
63
Ex: @Sql in Action
@ContextConfiguration
@Sql({ "schema1.sql", "data1.sql" })
public class SqlScriptsTests {
@Test
public void classLevelScripts() { /* ... */ }
@Test
@Sql({ "schema2.sql", "data2.sql" })
public void methodLevelScripts() { /* ... */ }
64
Default SQL Script Detection
•  If no scripts are declared, a default script will be detected
•  Depending on where @Sql is declared
•  Class-level: for com.example.DbTest, the default is “classpath:com/
example/DbTest.sql”
•  Method-level: for com.example.DbTest.test(), the default is
“classpath:com/example/DbTest.test.sql”
•  If the default is not present, an exception is thrown
65
Declaring Multiple @Sql Sets
•  Declare multiple sets of @Sql scripts for varying configuration
•  Java 8: use @Sql as a repeatable annotation
•  Java 6 & 7: wrap @Sql sets in @SqlGroup
66
@Sql as a Repeatable Annotation (Java 8)
67
@Test
@Sql(
scripts="/test-schema.sql",
config = @SqlConfig(commentPrefix = "`")
@Sql("/user-data.sql")
public void userTest() {
// code that uses the test schema and test data
}
Schema uses
custom syntax
@Sql wrapped in @SqlGroup (Java 6 & 7)
68
@Test
@SqlGroup({
@Sql(
scripts="/test-schema.sql",
config = @SqlConfig(commentPrefix = "`"),
@Sql("/user-data.sql")
})
public void userTest() {
// code that uses the test schema and test data
}
Configuring SQL Scripts with @SqlConfig
•  @SqlConfig: configures script parsing and error handling
•  Class-level: serves as global configuration for the test class
•  @Sql(config): serves as local configuration for the enclosing @Sql
•  Local configuration inherits global configuration and can
selectively override global configuration
•  Transaction management for script execution is configured via
the dataSource, transactionManager, and transactionMode
attributes
•  See Javadoc and reference manual for details
69
In closing…
70
Spring Resources
Spring Framework: http://projects.spring.io/spring-framework
Spring Guides: http://spring.io/guides
Spring JIRA: https://jira.spring.io
Spring on GitHub: https://github.com/spring-projects/spring-framework
Stack Overflow: spring, spring-test, spring-mvc, …
71
Blogs
Spring Blog: http://spring.io/blog
Swiftmind Blog: http://www.swiftmind.com/blog
72
Q & A
Sam Brannen
@sam_brannen
www.slideshare.net/sbrannen
www.swiftmind.com
73
@springcentral spring.io/video

Más contenido relacionado

La actualidad más candente

Testing Web Apps with Spring Framework
Testing Web Apps with Spring FrameworkTesting Web Apps with Spring Framework
Testing Web Apps with Spring FrameworkDmytro Chyzhykov
 
JUnit 5 — New Opportunities for Testing on the JVM
JUnit 5 — New Opportunities for Testing on the JVMJUnit 5 — New Opportunities for Testing on the JVM
JUnit 5 — New Opportunities for Testing on the JVMVMware Tanzu
 
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019Sam Brannen
 
Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Rossen Stoyanchev
 
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
An Introduction to JUnit 5 and how to use it with Spring boot tests and MockitoAn Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockitoshaunthomas999
 
Apache maven, a software project management tool
Apache maven, a software project management toolApache maven, a software project management tool
Apache maven, a software project management toolRenato Primavera
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkRajind Ruparathna
 
Spring Testing, Fight for the Context
Spring Testing, Fight for the ContextSpring Testing, Fight for the Context
Spring Testing, Fight for the ContextGlobalLogic Ukraine
 
San Jose Selenium Meet-up PushToTest TestMaker Presentation
San Jose Selenium Meet-up PushToTest TestMaker PresentationSan Jose Selenium Meet-up PushToTest TestMaker Presentation
San Jose Selenium Meet-up PushToTest TestMaker PresentationClever Moe
 
Infinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan KustInfinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan KustInfinum
 
Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Sam Brannen
 
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVMRyan Cuprak
 
Introduction to JUnit testing in OpenDaylight
Introduction to JUnit testing in OpenDaylightIntroduction to JUnit testing in OpenDaylight
Introduction to JUnit testing in OpenDaylightOpenDaylight
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Appschrisb206 chrisb206
 
Migrating a JSF-Based Web Application from Spring 3 to Java EE 7 and CDI
Migrating a JSF-Based Web Application from Spring 3 to Java EE 7 and CDIMigrating a JSF-Based Web Application from Spring 3 to Java EE 7 and CDI
Migrating a JSF-Based Web Application from Spring 3 to Java EE 7 and CDIMario-Leander Reimer
 
Oracle Unit Testing with utPLSQL
Oracle Unit Testing with utPLSQLOracle Unit Testing with utPLSQL
Oracle Unit Testing with utPLSQLBrendan Furey
 
Integration Group - Lithium test strategy
Integration Group - Lithium test strategyIntegration Group - Lithium test strategy
Integration Group - Lithium test strategyOpenDaylight
 

La actualidad más candente (20)

Testing Web Apps with Spring Framework
Testing Web Apps with Spring FrameworkTesting Web Apps with Spring Framework
Testing Web Apps with Spring Framework
 
JUnit 5 — New Opportunities for Testing on the JVM
JUnit 5 — New Opportunities for Testing on the JVMJUnit 5 — New Opportunities for Testing on the JVM
JUnit 5 — New Opportunities for Testing on the JVM
 
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
 
Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2
 
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
An Introduction to JUnit 5 and how to use it with Spring boot tests and MockitoAn Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
 
Apache maven, a software project management tool
Apache maven, a software project management toolApache maven, a software project management tool
Apache maven, a software project management tool
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring Testing, Fight for the Context
Spring Testing, Fight for the ContextSpring Testing, Fight for the Context
Spring Testing, Fight for the Context
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
 
San Jose Selenium Meet-up PushToTest TestMaker Presentation
San Jose Selenium Meet-up PushToTest TestMaker PresentationSan Jose Selenium Meet-up PushToTest TestMaker Presentation
San Jose Selenium Meet-up PushToTest TestMaker Presentation
 
Infinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan KustInfinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan Kust
 
Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2
 
PL/SQL unit testing with Ruby
PL/SQL unit testing with RubyPL/SQL unit testing with Ruby
PL/SQL unit testing with Ruby
 
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVM
 
Selenium With Spices
Selenium With SpicesSelenium With Spices
Selenium With Spices
 
Introduction to JUnit testing in OpenDaylight
Introduction to JUnit testing in OpenDaylightIntroduction to JUnit testing in OpenDaylight
Introduction to JUnit testing in OpenDaylight
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
 
Migrating a JSF-Based Web Application from Spring 3 to Java EE 7 and CDI
Migrating a JSF-Based Web Application from Spring 3 to Java EE 7 and CDIMigrating a JSF-Based Web Application from Spring 3 to Java EE 7 and CDI
Migrating a JSF-Based Web Application from Spring 3 to Java EE 7 and CDI
 
Oracle Unit Testing with utPLSQL
Oracle Unit Testing with utPLSQLOracle Unit Testing with utPLSQL
Oracle Unit Testing with utPLSQL
 
Integration Group - Lithium test strategy
Integration Group - Lithium test strategyIntegration Group - Lithium test strategy
Integration Group - Lithium test strategy
 

Destacado

Spring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSpring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSam Brannen
 
Effective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4DevelopersEffective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4DevelopersSam Brannen
 
Composable Software Architecture with Spring
Composable Software Architecture with SpringComposable Software Architecture with Spring
Composable Software Architecture with SpringSam Brannen
 
Accelerate with BIRT and Actuate11
Accelerate with BIRT and Actuate11Accelerate with BIRT and Actuate11
Accelerate with BIRT and Actuate11Raghavan Mohan
 
Spring Web Service, Spring JMS, Eclipse & Maven tutorials
Spring Web Service, Spring JMS, Eclipse & Maven tutorialsSpring Web Service, Spring JMS, Eclipse & Maven tutorials
Spring Web Service, Spring JMS, Eclipse & Maven tutorialsRaghavan Mohan
 
Enterprise Messaging With Spring JMS
Enterprise Messaging With Spring JMSEnterprise Messaging With Spring JMS
Enterprise Messaging With Spring JMSBruce Snyder
 
Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using SpringBeyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using SpringBruce Snyder
 
xlab #8 - Architektura mikroserwisów na platformie Spring Boot
xlab #8 - Architektura mikroserwisów na platformie Spring Bootxlab #8 - Architektura mikroserwisów na platformie Spring Boot
xlab #8 - Architektura mikroserwisów na platformie Spring BootXSolve
 
REST and RESTful Web Services
REST and RESTful Web ServicesREST and RESTful Web Services
REST and RESTful Web ServicesKasun Madusanke
 
JMS-Java Message Service
JMS-Java Message ServiceJMS-Java Message Service
JMS-Java Message ServiceKasun Madusanke
 
Spring Framework 4.0 to 4.1
Spring Framework 4.0 to 4.1Spring Framework 4.0 to 4.1
Spring Framework 4.0 to 4.1Sam Brannen
 
Migrate Heroku & OpenShift Applications to IBM BlueMix
Migrate Heroku & OpenShift Applications to IBM BlueMixMigrate Heroku & OpenShift Applications to IBM BlueMix
Migrate Heroku & OpenShift Applications to IBM BlueMixRohit Kelapure
 
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013Sam Brannen
 
Java EE vs Spring Framework
Java  EE vs Spring Framework Java  EE vs Spring Framework
Java EE vs Spring Framework Rohit Kelapure
 
Full lifecycle of a microservice
Full lifecycle of a microserviceFull lifecycle of a microservice
Full lifecycle of a microserviceLuigi Bennardis
 

Destacado (20)

Spring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSpring Framework 3.2 - What's New
Spring Framework 3.2 - What's New
 
Effective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4DevelopersEffective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4Developers
 
Composable Software Architecture with Spring
Composable Software Architecture with SpringComposable Software Architecture with Spring
Composable Software Architecture with Spring
 
Accelerate with BIRT and Actuate11
Accelerate with BIRT and Actuate11Accelerate with BIRT and Actuate11
Accelerate with BIRT and Actuate11
 
Spring Web Service, Spring JMS, Eclipse & Maven tutorials
Spring Web Service, Spring JMS, Eclipse & Maven tutorialsSpring Web Service, Spring JMS, Eclipse & Maven tutorials
Spring Web Service, Spring JMS, Eclipse & Maven tutorials
 
Spring tutorial
Spring tutorialSpring tutorial
Spring tutorial
 
Enterprise Messaging With Spring JMS
Enterprise Messaging With Spring JMSEnterprise Messaging With Spring JMS
Enterprise Messaging With Spring JMS
 
Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using SpringBeyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
 
Spring Services
Spring ServicesSpring Services
Spring Services
 
Spring annotation
Spring annotationSpring annotation
Spring annotation
 
xlab #8 - Architektura mikroserwisów na platformie Spring Boot
xlab #8 - Architektura mikroserwisów na platformie Spring Bootxlab #8 - Architektura mikroserwisów na platformie Spring Boot
xlab #8 - Architektura mikroserwisów na platformie Spring Boot
 
REST and RESTful Web Services
REST and RESTful Web ServicesREST and RESTful Web Services
REST and RESTful Web Services
 
JMS-Java Message Service
JMS-Java Message ServiceJMS-Java Message Service
JMS-Java Message Service
 
Javantura v4 - Support SpringBoot application development lifecycle using Ora...
Javantura v4 - Support SpringBoot application development lifecycle using Ora...Javantura v4 - Support SpringBoot application development lifecycle using Ora...
Javantura v4 - Support SpringBoot application development lifecycle using Ora...
 
Spring Framework 4.0 to 4.1
Spring Framework 4.0 to 4.1Spring Framework 4.0 to 4.1
Spring Framework 4.0 to 4.1
 
Migrate Heroku & OpenShift Applications to IBM BlueMix
Migrate Heroku & OpenShift Applications to IBM BlueMixMigrate Heroku & OpenShift Applications to IBM BlueMix
Migrate Heroku & OpenShift Applications to IBM BlueMix
 
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
 
Javantura v4 - Security architecture of the Java platform - Martin Toshev
Javantura v4 - Security architecture of the Java platform - Martin ToshevJavantura v4 - Security architecture of the Java platform - Martin Toshev
Javantura v4 - Security architecture of the Java platform - Martin Toshev
 
Java EE vs Spring Framework
Java  EE vs Spring Framework Java  EE vs Spring Framework
Java EE vs Spring Framework
 
Full lifecycle of a microservice
Full lifecycle of a microserviceFull lifecycle of a microservice
Full lifecycle of a microservice
 

Similar a Spring Framework 4.1

Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012Sam Brannen
 
Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011Sam Brannen
 
Spring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam BrannenSpring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam BrannenJAX London
 
Spring 4-groovy
Spring 4-groovySpring 4-groovy
Spring 4-groovyGR8Conf
 
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next GenerationJAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generationjazoon13
 
Spring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerSpring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerZeroTurnaround
 
Spring data presentation
Spring data presentationSpring data presentation
Spring data presentationOleksii Usyk
 
JavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersJavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersRob Windsor
 
Ajug - The Spring Update
Ajug - The Spring UpdateAjug - The Spring Update
Ajug - The Spring UpdateGunnar Hillert
 
Spring 3.1: a Walking Tour
Spring 3.1: a Walking TourSpring 3.1: a Walking Tour
Spring 3.1: a Walking TourJoshua Long
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - ExplainedSmita Prasad
 
How to generate a REST CXF3 application from Swagger ApacheConEU 2016
How to generate a REST CXF3 application from Swagger ApacheConEU 2016How to generate a REST CXF3 application from Swagger ApacheConEU 2016
How to generate a REST CXF3 application from Swagger ApacheConEU 2016johannes_fiala
 
Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Robert Scholte
 
Effective out-of-container Integration Testing
Effective out-of-container Integration TestingEffective out-of-container Integration Testing
Effective out-of-container Integration TestingSam Brannen
 

Similar a Spring Framework 4.1 (20)

Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
 
Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011
 
Spring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam BrannenSpring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam Brannen
 
Spring 4-groovy
Spring 4-groovySpring 4-groovy
Spring 4-groovy
 
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next GenerationJAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
 
Spring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerSpring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen Hoeller
 
Maven basic concept
Maven basic conceptMaven basic concept
Maven basic concept
 
Spring data presentation
Spring data presentationSpring data presentation
Spring data presentation
 
JavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersJavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint Developers
 
Get ready for spring 4
Get ready for spring 4Get ready for spring 4
Get ready for spring 4
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
The Spring Update
The Spring UpdateThe Spring Update
The Spring Update
 
Ajug - The Spring Update
Ajug - The Spring UpdateAjug - The Spring Update
Ajug - The Spring Update
 
JSF2
JSF2JSF2
JSF2
 
Spring 3.1: a Walking Tour
Spring 3.1: a Walking TourSpring 3.1: a Walking Tour
Spring 3.1: a Walking Tour
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
 
Introduction to Monsoon PHP framework
Introduction to Monsoon PHP frameworkIntroduction to Monsoon PHP framework
Introduction to Monsoon PHP framework
 
How to generate a REST CXF3 application from Swagger ApacheConEU 2016
How to generate a REST CXF3 application from Swagger ApacheConEU 2016How to generate a REST CXF3 application from Swagger ApacheConEU 2016
How to generate a REST CXF3 application from Swagger ApacheConEU 2016
 
Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)
 
Effective out-of-container Integration Testing
Effective out-of-container Integration TestingEffective out-of-container Integration Testing
Effective out-of-container Integration Testing
 

Más de Sam Brannen

Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Sam Brannen
 
Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Sam Brannen
 
JUnit 5: What's New and What's Coming - Spring I/O 2019
JUnit 5: What's New and What's Coming - Spring I/O 2019JUnit 5: What's New and What's Coming - Spring I/O 2019
JUnit 5: What's New and What's Coming - Spring I/O 2019Sam Brannen
 
Spring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4DevelopersSpring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4DevelopersSam Brannen
 
Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012Sam Brannen
 
Spring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSpring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSam Brannen
 
Spring 3.1 in a Nutshell
Spring 3.1 in a NutshellSpring 3.1 in a Nutshell
Spring 3.1 in a NutshellSam Brannen
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSam Brannen
 
What's New in Spring 3.0
What's New in Spring 3.0What's New in Spring 3.0
What's New in Spring 3.0Sam Brannen
 
Modular Web Applications with OSGi
Modular Web Applications with OSGiModular Web Applications with OSGi
Modular Web Applications with OSGiSam Brannen
 
Enterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm ServerEnterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm ServerSam Brannen
 

Más de Sam Brannen (11)

Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
 
Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022
 
JUnit 5: What's New and What's Coming - Spring I/O 2019
JUnit 5: What's New and What's Coming - Spring I/O 2019JUnit 5: What's New and What's Coming - Spring I/O 2019
JUnit 5: What's New and What's Coming - Spring I/O 2019
 
Spring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4DevelopersSpring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4Developers
 
Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012
 
Spring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSpring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing Support
 
Spring 3.1 in a Nutshell
Spring 3.1 in a NutshellSpring 3.1 in a Nutshell
Spring 3.1 in a Nutshell
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
What's New in Spring 3.0
What's New in Spring 3.0What's New in Spring 3.0
What's New in Spring 3.0
 
Modular Web Applications with OSGi
Modular Web Applications with OSGiModular Web Applications with OSGi
Modular Web Applications with OSGi
 
Enterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm ServerEnterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm Server
 

Último

The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 

Último (20)

The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 

Spring Framework 4.1

  • 1. Spring Framework 4.1 Sam Brannen @sam_brannen
  • 2. Sam Brannen •  Spring and Java Consultant @ Swiftmind •  Java Developer for over 15 years •  Spring Framework Core Committer since 2007 •  Component lead for spring-test •  Spring Trainer •  Speaker on Spring, Java, and testing •  Swiss Spring User Group Lead 2
  • 3. Areas of expertise –  Spring * –  Java EE –  Software Architecture –  Software Engineering Best Practices Where you find us •  Zurich, Switzerland •  @swiftmind •  http://www.swiftmind.com 3 Your experts for Spring & Enterprise Java
  • 4. A show of hands… 4 ? ? ? ? ? ?
  • 5. Agenda •  Container enhancements •  Caching •  JMS •  Spring MVC •  Testing •  Q&A 5
  • 7. Enhancements in 4.1 •  java.util.Optional •  Dependency injection •  MVC method arguments •  @Order on @Bean methods •  Injecting ordered lists •  @Priority (javax.annotation) •  Ordering •  Primary candidate selection •  SpEL compiler •  Modes: off, immediate, mixed •  System / Spring property: spring.expression.compiler.mode 7
  • 8. Injection point with required flag @Service public class MyService { @Autowired(required=false) NotificationService notificationService; public Book findBook(long id) { if (notificationService != null) { /* ... */ } } } 8 before
  • 9. Injection point with java.util.Optional @Service public class MyService { @Autowired Optional<NotificationService> notificationService; public Book findBook(long id) { notificationService.ifPresent(service -> /* ... */ ); } } 9 after
  • 10. @Order on Components (4.0) @Service @Order(1) public class ServiceA implements MyService { /* ... */ } @Service @Order(2) public class ServiceB implements MyService { /* ... */ } @Autowired List<MyService> myServices; 10 ServiceA is 1st
  • 11. @Order on @Bean Methods (4.1) @Bean @Order(1) public MyService serviceA() { return new ServiceA(); } @Bean @Order(2) public MyService serviceB() { return new ServiceB(); } @Autowired List<MyService> myServices; 11 ServiceA is 1st
  • 13. New Caching Features •  @CacheConfig •  common class-level configuration •  CacheResolver •  fine grained, programmatic cache resolution •  JCache (JSR-107) •  New putIfAbsent() method in Cache API 13
  • 14. Review: Spring Caching API 14 “books” cache name is duplicated everywhere. L
  • 15. @CacheConfig 15 “books” cache name is declared only once! J
  • 16. CacheResolver API 16 •  getOperation() •  getTarget() •  getMethod() •  getArgs()
  • 17. JCache (JSR 107) and Spring •  JCache 1.0 annotations now supported in Spring •  Integration based on Spring’s own Cache and CacheManager APIs •  JCacheCache and JCacheCacheManager •  Enabled via Spring’s standard mechanisms: •  XML: <cache:annotation-driven /> •  Java: @EnableCaching •  Cache Abstraction: JCache (JSR-107) Annotations Support •  https://spring.io/blog/2014/04/14/cache-abstraction-jcache-jsr-107-annotations-support 17
  • 19. Caching Annotations Comparison 19 Spring JCache @Cacheable @CacheResult @CachePut @CachePut @CacheEvict @CacheRemove @CacheEvict(allEntries=true) @CacheRemoveAll
  • 21. JMS Overhaul •  Alignment with spring-messaging module •  Annotation-driven endpoints •  Analogous to <jms:listener-container /> •  Listener methods declared via @JmsListener •  Configured via: o  XML: <jms:annotation-driven /> o  Java: @EnableJms and JmsListenerConfigurer 21
  • 22. Review: Spring JMS Config in XML 22
  • 25. Transition from existing XML config… 25
  • 26. … or remove XML altogether 26
  • 28. ResponseBodyAdvice •  Callback for @ResponseBody / ResponseEntity methods •  just before the response is written (and committed) •  you can still modify headers •  or the object to be written to the response •  Two implementations already •  JsonViewResponseBodyAdvice •  AbstractJsonpResponseBodyAdvice 28
  • 29. Jackson @JsonView Support interface PublicView {} class User { @JsonView(PublicView.class) String username; String password; // ... } 29 @RestController class UserController { @RequestMapping("/user") @JsonView(PublicView.class) public User getUser() { return new User("eric", "7!#H2"); } }
  • 30. JSONP Support •  Simply declare as a Spring-managed component… @ControllerAdvice class JsonpAdvice extends AbstractJsonpResponseBodyAdvice { public JsonpAdvice() { super("callback"); } } 30 Name of JSONP query param(s)
  • 31. HttpMessageConverter Additions •  Gson •  lighter footprint (vs Jackson); used in Spring Android •  Google Protocol Buffers •  effective inter-service communication data protocol •  Jackson / XML •  just add jackson-dataformat-xml to the classpath 31
  • 32. Static Resource Handling in Web MVC •  ResourceTransformer API •  Transforms the content of a resource •  ResourceResolver API for resolving: •  Internal static resources •  External resource paths (i.e., links) •  ResourceResolverChain •  Maintains a chain of resolvers •  Allowing for delegation •  Configured via ResourceHandlerRegistry •  For example, via WebMvcConfigurationSupport 32
  • 33. ResourceResolver Implementations •  PathResourceResolver •  simple path lookup under configured locations •  VersionResourceResolver •  resolution with version in URL path •  GzipResourceResolver •  lookup with .gz extension when “Accept-Encoding: gzip” •  CachingResourceResolver •  caching of resolved resource 33
  • 34. ResourceTransformer Implementations •  CssLinkResourceTransformer •  update links in CSS file (e.g. insert version) •  AppCacheManifestTransformer •  update links in HTML5 AppCache manifest •  insert comment with content-based hash •  CachingResourceTransformer •  caching of transformed resource 34
  • 35. Ex: Fingerprinting URLs w/ content-based version boolean useResourceCache = !this.environment.acceptsProfiles("dev"); VersionResourceResolver resolver = new VersionResourceResolver(); resolver.addContentVersionStrategy("/**"); registry.addResourceHandler("/**").addResourceLocations(locations) .resourceChain(useResourceCache).addResolver(resolver); Example URL: “/css/font-awesome.min-7fbe76cdac.css” 35
  • 36. Additional New Features in Spring MVC •  Groovy markup templates •  Declarative MVC view resolution •  Enhanced view controllers •  Linking to @RequestMapping methods •  See HandlerMethodMappingNamingStrategy •  ListenableFuture return type for handler methods •  ResponseEntity Builder API •  RequestEntity & RestTemplate.exchange() 36
  • 38. Bootstrap Strategy & TestExecutionListeners •  TestContext bootstrap strategy •  TestContextBootstrapper & @BootstrapWith •  Automatic discovery of default TestExecutionListeners •  Uses SpringFactoriesLoader •  Already used by Spring Security •  Merging custom TestExecutionListeners with defaults •  @TestExecutionListeners(mergeMode=MERGE_WITH_DEFAULTS) •  Defaults to REPLACE_DEFAULTS 38
  • 39. Spring MVC Test •  Assert JSON responses with JSON Assert •  Complements JSONPath support •  Create MockMvcBuilder recipes with MockMvcConfigurer •  Developed to apply Spring Security setup but can be used by anyone •  AsyncRestTemplate support in MockRestServiceServer •  For asynchronous client-side testing 39
  • 40. Groovy Beans in Spring •  Spring Framework 4.0 introduced support for the Groovy Bean Definition DSL via the GroovyBeanDefinitionReader and GenericGroovyApplicationContext •  Spring Framework 4.1 introduces support for Groovy scripts in web applications via the GroovyWebApplicationContext •  Testing support added in 4.1… 40
  • 41. Groovy Scripts for Context Config in Tests •  Spring Framework 4.1 introduces support for Groovy scripts in integration tests via @ContextConfiguration •  Scripts are configured via the locations or value attribute o  Resource semantics identical to XML o  Default detected with “Context.groovy” suffix in same package •  The inheritLocations flag is fully supported •  Groovy and XML configuration can be declared together •  Groovy WebApplicationContexts supported via @WebAppConfiguration 41
  • 42. Ex: Groovy Script Config @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/context.groovy") public class GroovyPersonTests { @Autowired private Person person; /* test methods using person bean */ } 42
  • 43. Ex: Default Groovy Script Detection public com.example; @RunWith(SpringJUnit4ClassRunner.class) // ApplicationContext will be loaded from // “classpath:com/example/MyTestContext.groovy” @ContextConfiguration public class MyTest { /* ... */ } 43
  • 44. Ex: Groovy & XML Config Together @RunWith(SpringJUnit4ClassRunner.class) // ApplicationContext will be loaded from // “/context.groovy” and “/context.xml” @ContextConfiguration({ "/context.groovy", "/context.xml" }) public class MyTest { /* ... */ } 44
  • 45. Test Property Sources •  Spring 3.1 introduced PropertySources abstraction •  Configured via Environment or via @PropertySource •  Spring 4.1 supports declarative test property sources •  Configured via @TestPropertySource •  Test property sources are declared via annotation attributes •  locations or value: resource locations •  properties: inlined properties •  both are inherited by default 45
  • 46. @TestPropertySource – locations •  String array of resource locations for Java Properties files •  Both traditional *.properties and XML formats are supported •  Resource semantics are identical to those for locations in @ContextConfiguration 46
  • 47. Ex: @TestPropertySource – locations @ContextConfiguration @TestPropertySource("/test.properties") public class MyIntegrationTests { // class body... } 47
  • 48. @TestPropertySource – properties •  Inlined properties can be declared as key/value pairs •  Uses syntax for entries in Java properties files: •  "key=value" •  "key:value" •  "key value" 48
  • 49. Ex: @TestPropertySource – properties @ContextConfiguration @TestPropertySource( properties = {"foo=bar", "port: 4242"} ) public class MyIntegrationTests { // class body... } 49
  • 50. Default Properties File Detection •  If neither locations nor properties are defined, a default properties file will be detected •  Default is detected with “.properties” suffix in same package •  If the class is com.example.MyTest, the default properties file is “classpath:com/example/MyTest.properties” •  Exception is thrown if default is not present 50
  • 52. Ex: @TestPropertySource – locations & properties @ContextConfiguration @TestPropertySource( locations = "/test.properties", properties = "port: 4242" ) public class MyIntegrationTests { // class body... } 52
  • 53. Programmatic Transaction Management in Tests •  History Lesson: Spring’s JUnit 3.8 testing framework supported endTransaction() and startNewTransaction() methods in AbstractTransactionalSpringContextTests •  But… the Spring TestContext Framework, introduced in Spring 2.5, did not… until now •  Due to popular demand, Spring 4.1 introduces a new TestTransaction API 53
  • 54. Transactions in Spring •  Spring-managed transactions: managed by Spring in the ApplicationContext •  @Transactional and AOP •  Application-managed transactions: managed programmatically within application code •  TransactionTemplate and TransactionSynchronizationManager •  Test-managed transactions: managed by the Spring TestContext Framework •  @Transactional on test classes and test methods •  Transaction is rolled back by default! 54
  • 55. Ex: Declarative Transaction Management in Tests @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration @Transactional public class TransactionalTests { @Test public void withinTransaction() { /* ... */ } 55 What if we want to stop & start the transaction within the test method?
  • 56. TestTransaction API •  Static methods for interacting with test-managed transactions •  isActive() •  isFlaggedForRollback() •  flagForCommit() •  flagForRollback() •  end() •  start() 56 query status change default rollback setting end: roll back or commit based on flag start: new tx with default rollback setting
  • 57. Ex: Programmatic Tx Management in Tests @Test 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... } 57
  • 59. Ex: Embedded Database in Java Config 59 @Bean public DataSource dataSource() { return new EmbeddedDatabaseBuilder() .setType(H2) .setScriptEncoding("UTF-8") .ignoreFailedDrops(true) .addScript("schema.sql") .addScripts("user_data.sql", "country_data.sql") .build(); } API greatly improved in Spring 4.0.3
  • 60. Ex: Embedded Database in XML Config <jdbc:embedded-database id="dataSource" type="H2"> <jdbc:script location="classpath:/schema.sql" /> <jdbc:script location="classpath:/user_data.sql" /> </jdbc:embedded-database> 60
  • 61. Ex: Populate Database in XML Config <jdbc:initialize-database data-source="dataSource"> <jdbc:script location="classpath:/schema_01.sql" /> <jdbc:script location="classpath:/schema_02.sql" /> <jdbc:script location="classpath:/data_01.sql" /> <jdbc:script location="classpath:/data_02.sql" /> </jdbc:initialize-database> 61
  • 62. Executing SQL per Test Method •  The previous techniques are very useful for setting up the initial database state •  Q: But how can we execute SQL scripts per test method? •  A: Programmatically via ScriptUtils, ResourceDatabasePopulator, or abstract transactional base test classes for JUnit and TestNG. •  Q: OK, but how can we do that declaratively? •  A: Via @Sql in Spring Framework 4.1! 62
  • 63. Executing SQL Scripts Declaratively with @Sql •  @Sql: declared on a test class or test method •  method-level overrides class-level •  The scripts attribute is used to declare resource locations for SQL scripts •  semantics analogous to locations in @ContextConfiguration •  Scripts can be executed before or after a test method •  configured via the executionPhase attribute of @Sql 63
  • 64. Ex: @Sql in Action @ContextConfiguration @Sql({ "schema1.sql", "data1.sql" }) public class SqlScriptsTests { @Test public void classLevelScripts() { /* ... */ } @Test @Sql({ "schema2.sql", "data2.sql" }) public void methodLevelScripts() { /* ... */ } 64
  • 65. Default SQL Script Detection •  If no scripts are declared, a default script will be detected •  Depending on where @Sql is declared •  Class-level: for com.example.DbTest, the default is “classpath:com/ example/DbTest.sql” •  Method-level: for com.example.DbTest.test(), the default is “classpath:com/example/DbTest.test.sql” •  If the default is not present, an exception is thrown 65
  • 66. Declaring Multiple @Sql Sets •  Declare multiple sets of @Sql scripts for varying configuration •  Java 8: use @Sql as a repeatable annotation •  Java 6 & 7: wrap @Sql sets in @SqlGroup 66
  • 67. @Sql as a Repeatable Annotation (Java 8) 67 @Test @Sql( scripts="/test-schema.sql", config = @SqlConfig(commentPrefix = "`") @Sql("/user-data.sql") public void userTest() { // code that uses the test schema and test data } Schema uses custom syntax
  • 68. @Sql wrapped in @SqlGroup (Java 6 & 7) 68 @Test @SqlGroup({ @Sql( scripts="/test-schema.sql", config = @SqlConfig(commentPrefix = "`"), @Sql("/user-data.sql") }) public void userTest() { // code that uses the test schema and test data }
  • 69. Configuring SQL Scripts with @SqlConfig •  @SqlConfig: configures script parsing and error handling •  Class-level: serves as global configuration for the test class •  @Sql(config): serves as local configuration for the enclosing @Sql •  Local configuration inherits global configuration and can selectively override global configuration •  Transaction management for script execution is configured via the dataSource, transactionManager, and transactionMode attributes •  See Javadoc and reference manual for details 69
  • 71. Spring Resources Spring Framework: http://projects.spring.io/spring-framework Spring Guides: http://spring.io/guides Spring JIRA: https://jira.spring.io Spring on GitHub: https://github.com/spring-projects/spring-framework Stack Overflow: spring, spring-test, spring-mvc, … 71
  • 72. Blogs Spring Blog: http://spring.io/blog Swiftmind Blog: http://www.swiftmind.com/blog 72
  • 73. Q & A Sam Brannen @sam_brannen www.slideshare.net/sbrannen www.swiftmind.com 73 @springcentral spring.io/video