BUGS: habuma/spring-in-action-5-samples#40
-
Initializing spring project on start.spring.io
-
Initializing Git Repository and Push to remote
- Initialize local:
https://www.youtube.com/watch?v=hks47h4C_nY
https://www.youtube.com/watch?v=bvl4Kbe-qok - Initialize remote: push and commit
- Initialize local:
-
Spring Tools 4
- https://docs.spring.io/spring-boot/docs/current/reference/html/using-spring-boot.html#using-boot-structuring-your-code
- https://stackoverflow.com/questions/40902280/what-is-the-recommended-project-structure-for-spring-boot-rest-projects
- Add missing unit tests
Testing:
- https://developers.bluesnap.com/docs/test-credit-cards
- Visa / 4263982640269299 / 04/23 / 738
-
this::methodname ...Method Reference
- https://www.geeksforgeeks.org/double-colon-operator-in-java/
- https://stackify.com/streams-guide-java-8/
- this refers to Object, not class
- p. 809 / 1009
-
enum
(javabook p. 429 / 712 / 617) -
equals()
-
hashCode()
-
toString()
(javabook p.483) -
List<>
(javabook p.980) -
Array.asList(...)
(javabook p.990) -
for (x : y)
(javabook p.279) -
Streams, .filter
(javabook p.1009)
https://winterbe.com/posts/2014/07/31/java8-stream-tutorial-examples/
"GetMapping cannot be resolved to a type":
Bug in test for HomeController ...import org.junit.Test
could not be resolved:
Lombock installation Problems:
- Download lombok.jar
- sudo java -jar lombok.jar
- manually set eclipse path: /snap/eclipse/48/ Still not working!
-
Model - View
-
Model - View-Bibliothek
-
Request Mapping / GetMapping
-
Beans
https://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html
https://www.thymeleaf.org/doc/articles/standarddialect5minutes.html
-
th:object ...line 15 design.html
probably object, where form is stored -
th:field="*{...}"
connects form input to taco dto name-property
(Java book p.930)
- JUL: java.util.logging
- @NotNull
- @Size(min=..., message="...")
- @NotBlank
- @Pattern
- @Digits
- @CreditCardNumber (Hibernate)
Problem: Needed to add to pom.xml:
Solution: https://www.baeldung.com/javax-validation
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
Problem: Error Message now shown, instead: Whitelabel Error Page
Solution: http://forum.thymeleaf.org/Fields-object-functions-Spring-td3302513.html
Problem: Validation evaluation not working with taco design page!!! MAASSIV Error if not enough ingredients choosen?!? WTF Fucked-up-beyond-believe bullshit useles error message!
Solution: NONE
(p. 55)
????
Goal:
- Use Jdbc Template from Spring
- Insert data with SimpleJbcInsert
- Declare JPA-Repositories with Spring Data
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
https://www.youtube.com/watch?v=8QBJMxyXIqc
https://howtodoinjava.com/spring-boot2/h2-database-example/
https://www.youtube.com/watch?v=8QBJMxyXIqc
http://localhost:8080/h2-console/
- URL:
jdbc:h2:mem:testdb
General
- Domain Driven Design
- Repositories
- JPA / JDBC
Annotations / methods
- @Autowired
- @Repository
- jdbc.query queryForObject
**H2 / Hibernate **
- schema.sql ...for creating database-schema
- data.spl ...for populating database automatically by spring
- SQL Statements:
- CREATE TABLE IF NOT EXITS (...NOT NULL)
- ALTER TABLE ...ADD FOREIGN KEY...REFERENCES
- DELETE FROM
- DELETE FROM .. WHERE ...
- CREATE TABLE ... IF NOT EXISTS
JdbcTemplate
- "query"
- "queryForObject"
- "update"
- PreparedStatementCreator
- KeyHolder
Java / Spring
- Converter ... to convert string-to-object for change that ingredients come from database instead hardcodet; auto-registration in Spring (Boot?) (see "Problems")
JDBC
- https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/#jdbc.repositories
- https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/#repositories
- http://zetcode.com/db/jdbctemplate/
- https://www.baeldung.com/spring-jdbc-jdbctemplate
- https://www.baeldung.com/spring-jdbctemplate-testing
Converter
- https://stackoverflow.com/questions/35025550/register-spring-converter-programmatically-in-spring-boot
- spring-projects/spring-framework#11081
- https://www.baeldung.com/spring-type-conversions
####CONVERTER
..."when private List ingredients; was private List ingredients; it worked,
but now it must be private List ingredients; because of the way it is saved in the database
but it breaks at this point, how to fix it?"
https://stackoverflow.com/questions/55093954/thymeleaf-failed-to-convert-property-value-of-type-java-lang-string-to-required/63328365#63328365
Keyholder - NullPointerException
habuma/spring-in-action-5-samples#40
http://mkaroune.e-monsite.com/pages/keyholder-getkey-return-null.html
Solution
- https://www.baeldung.com/spring-type-conversions
- https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/core/convert/converter/Converter.html
... List property of "order" class not saved from design to order forms! So wont be stored in database!?!