Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,11 @@ tmp-md/
fullstack-book/docs
fullstack-book/blog
fullstack-book/static

# Gradle
.gradle/
**/build/

# Gradle
.gradle/
**/build/
Binary file modified backend/.gradle/8.14.2/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified backend/.gradle/8.14.2/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified backend/.gradle/8.14.2/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified backend/.gradle/8.14.2/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified backend/.gradle/8.14.2/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified backend/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified backend/.gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e6d4318f-c7ac-47ed-976c-c4c1bd03c2b�
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�$��*?� ���?��{d
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
k5@���Q:e���ٶK��v�e
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
* The entry point of the app
*/

@SpringBootApplication
public class SpringRestApplication {

/**
* The Main method
* @param args main program parameters
*/
public static void main(String[] args) {
SpringApplication.run(SpringRestApplication.class, args);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public class ProductController {
* <p>Default page size is 20, sorted by {@code id DESC}. Override with
* query params like {@code ?page=1&size=50&sort=name,asc}.</p>
*
* @param pageable pagination & sorting (page, size, sort)
* @param pageable pagination and sorting (page, size, sort)
* @return page of {@link ProductResponse}
*/
@Operation(
Expand Down Expand Up @@ -145,7 +145,7 @@ public Page<ProductResponse> getAll(
* Searches products by (case-insensitive) name substring.
*
* @param q required query string to match within product names
* @param pageable pagination & sorting (page, size, sort)
* @param pageable pagination and sorting (page, size, sort)
* @return page of matches
*/
@Operation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class GlobalExceptionHandler {
* the error message.
* </p>
*
* <h3>Old way (imperative)</h3>
* <p><strong>Old way (imperative)</strong></p>
* <pre>{@code
* Map<String, String> error = new HashMap<>();
* error.put("error", ex.getMessage());
Expand All @@ -77,7 +77,7 @@ public class GlobalExceptionHandler {
* @param ex the exception containing the cause of the resource lookup failure
* @return a map with a single entry {@code "error": message}
*
* <h2>Example</h2>
* <p><strong>Example</strong></p>
* <pre>{@code
* {
* "error": "Product not found with ID: 99"
Expand All @@ -99,7 +99,7 @@ public Map<String, String> handleResourceNotFoundException(ResourceNotFoundExcep
* their corresponding validation error messages.
* </p>
*
* <h3>Old way (imperative)</h3>
* <p><strong>Old way (imperative)</strong></p>
* <pre>{@code
* Map<String, String> error = new HashMap<>();
* for (FieldError fieldError : ex.getBindingResult().getFieldErrors()) {
Expand All @@ -111,7 +111,7 @@ public Map<String, String> handleResourceNotFoundException(ResourceNotFoundExcep
* @param ex the exception containing details of all validation errors
* @return a map of field names to validation messages
*
* <h2>Example</h2>
* <p><strong>Example</strong></p>
* <pre>{@code
* {
* "name": "Name is mandatory",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
* }
* }</pre>
*
* @apiNote Mapping behavior is compile-time generated; if you add new fields to the entity/DTOs,
* consider enabling MapStruct's {@code unmappedTargetPolicy = ReportingPolicy.ERROR} to catch omissions.
* <p><strong>API note:</strong> Mapping behavior is compile-time generated; if you add new fields to the entity/DTOs,
* consider enabling MapStruct's {@code unmappedTargetPolicy = ReportingPolicy.ERROR} to catch omissions. </p>
* @since 1.0
*/
@Mapper(componentModel = "spring")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
* Page<Product> mugs = repo.findByNameContainingIgnoreCase("mug", PageRequest.of(0, 10));
* }</pre>
*
* <p><strong>Performance tips</strong>:
* <p><strong>Performance tips</strong>: </p>
* <ul>
* <li>Consider an index on {@code lower(name)} for large catalogs to speed up case-insensitive matching.</li>
* <li>Always pass a {@link Pageable} to avoid loading large result sets into memory.</li>
* </ul>
* </p>
*
* @since 1.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
/**
* Application service encapsulating business operations for {@link Product}s.
*
* <p><strong>Responsibilities</strong>:
* <p><strong>Responsibilities</strong>: </p>
* <ul>
* <li>Read operations with pagination &amp; search.</li>
* <li>Create, update, delete with transactional safety.</li>
* <li>Consistent "not found" behavior via {@link #getOrThrow(Long)}.</li>
* </ul>
* </p>
*
* <h2>Usage</h2>
* <pre>{@code
Expand All @@ -44,8 +43,8 @@
* <li>Read methods are non-transactional by default for better throughput.</li>
* </ul>
*
* @implNote This service is stateless and thread-safe under typical Spring usage. Avoid holding JPA entities
* between calls; always load and save within a transaction boundary.
* <p><strong>Implementation note:</strong> This service is stateless and thread-safe under typical Spring usage. Avoid holding JPA entities
* between calls; always load and save within a transaction boundary. </p>
* @since 1.0
*/
@Service
Expand Down