Skip to content

Commit

Permalink
fix wrong source code of product lab
Browse files Browse the repository at this point in the history
  • Loading branch information
andifalk committed Sep 18, 2023
1 parent 2d814d8 commit af8765c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions labs/initial/product/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,14 @@ __com.example.ProductInitializer.java__:
```java
package com.example;
import com.example.product.ProductEntityEntity;
import com.example.product.ProductEntity;
import com.example.product.ProductEntityRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.math.BigDecimal;
import java.util.stream.Stream;
/** Initializes some products in database. */
Expand All @@ -256,11 +256,11 @@ public class ProductInitializer implements CommandLineRunner {
@Override
public void run(String... strings) {
Stream.of(
new ProductEntity("Apple", "A green apple", 3.50),
new ProductEntity("Banana", "The perfect banana", 7.00),
new ProductEntity("Orange", "Lots of sweet oranges", 33.00),
new ProductEntity("Pineapple", "Exotic pineapple", 1.50),
new ProductEntity("Grapes", "Red wine grapes", 10.75))
new ProductEntity("Apple", "A green apple", BigDecimal.valueOf(3.50)),
new ProductEntity("Banana", "The perfect banana", BigDecimal.valueOf(7.00)),
new ProductEntity("Orange", "Lots of sweet oranges", BigDecimal.valueOf(33.00)),
new ProductEntity("Pineapple", "Exotic pineapple", BigDecimal.valueOf(1.50)),
new ProductEntity("Grapes", "Red wine grapes", BigDecimal.valueOf(10.75)))
.forEach(productEntityRepository::save);
LOG.info("Created " + productEntityRepository.count() + " products");
Expand All @@ -276,6 +276,7 @@ In class `com.example.product.ProductRestController` we do not get `ProductUser`
Instead, by default the class `org.springframework.security.oauth2.jwt.Jwt` will be provided as input (as this is the standard authenticated principle object when JWT is used in spring security).

```java
@SecurityRequirement(name = "bearerAuth")
@RestController
public class ProductRestController {
//...
Expand Down

0 comments on commit af8765c

Please sign in to comment.