Tuesday, November 27, 2018

some Spring API notes

  1. Annotations in Spring are the bits of markup with a leading at symbol, kinda like decorators in TypeScript.
  2. Spring started out as an IoC container.
  3. Enterprise JavaBeans in Java are not needed for Spring and typically one does Spring without them. The EJBs are heavier, clunkier, other architecture.
  4. POJO stands for Plain Old Java Object.
  5. A template method pattern is the basic theme of an architecture implementation, defining the basic behavior of an application at a high level.
  6. You have to use Maven or Gradle to download Spring stuff.
  7. Java Database Connectivity (JDBC) is an inferior approach to Spring.
  8. Spring MVC is a web framework and Spring Data is for access to the database.
  9. @ResponseBody is for converting a message into an HTML response. If a @Controller is changed into a @RestController you do not explicitly need the @ResponseBody syntax.
  10. We need a mapping inside of a controller to map a route to a URL. Mappings have a distinction between @GetMapping and @PostMapping for example.
  11. The pom.xml file (POM being Project Object Model) is the base configuration file in a Maven project.
  12. A @PathVariable extends a URL/mapping to allow for an id to be handed in for a Get or a Delete as the last bit of a route. If you need a more specific variable with a name in the stuff after the question mark in a URL you may use a @RequestParm for such.
  13. @ExceptionHandler can return an error message.
  14. JUnit is the defaut testing framework. Spring Boot, AssertJ, and Hamcrest (anagram of matchers) are rivals. JSONPath is for walking what is in a JSON object and Mockito is for mocking.
  15. HatEoAS uses JSON with URL links in it. The Richardson Maturity Model (named for a Leonard Richardson) has HatEoAS as the best way to go, better than just REST which is in turn better than just services, not-quite-REST without concern for the HTTP (hypertext transfer protocol) verbs, which is in turn yet better than the swamp of POX (Plain Old XML).

No comments:

Post a Comment