Spring 223211613677232632
Spring 223211613677232632
transaction managers
rest clients
DB connection pools
testing mechanisms
Spring
Need "metadata"
Annotations → better
JavaConfig → preferred
Many "starters"
http://start.spring.io
- ContentNegotiatingViewResolver
- BeanNameViewResolver
- HttpMessageConverters
- Static content:
- /static or /public or /resources directory
Path Matching and Content Negotiation
Disables suffix pattern matching by default
- FreeMarker
- Groovy
- Thymeleaf
- Mustache
@ExtendWith(SpringExtension.class)
MockMvc package
MockMvcRequestBuilders
MockMvcRequestMatchers
Testing
Integration tests:
@MockBean
@Valid
application.properties:
spring.datasource.schema, spring.datasource.data
Transactions
Spring transactions configured with @Transactional
Propagation levels:
READ_UNCOMMITTED, READ_COMMITTED,
REPEATABLE_READ, SERIALIZABLE
JPA
Java Persistence API
@PersistenceContext → EntityManager
Spring Data
Large, powerful API
CrudRepository, PagingAndSortingRepository
Either:
Or:
Hander class
all methods take ServerRequest and return ServerResponse
References
- Spring in Action, 5th edition, by Craig Walls
- For Hibernate/JPA
- Pro JPA 2, 2nd edition (on Safari)
- https://thoughts-on-java.org/ has lots of Hibernate tips
- https://vladmihalcea.com/books/high-performance-java-persistence/
- Online reference docs for:
- Spring Framework
- Spring Boot
- Spring Data
- Spring Security