Spring Boot In Action May 2026

java -jar target/myapp-0.0.1-SNAPSHOT.jar

@Service @RequiredArgsConstructor public class BookService private final BookRepository bookRepo; public Book saveBook(Book book) return bookRepo.save(book); Spring Boot In Action

@Test void shouldCreateBook() throws Exception mockMvc.perform(post("/api/books") .contentType(MediaType.APPLICATION_JSON) .content("\"title\":\"Spring Boot in Action\",\"author\":\"Craig Walls\"")) .andExpect(status().isOk()); java -jar target/myapp-0

application-dev.properties , application-prod.properties Activate: spring.profiles.active=dev 5. Data Persistence (JPA + Repository) Entity: public Book saveBook(Book book) return bookRepo.save(book)