This source is based at the course of springframework.guru using Java 10 and Gradle !
In this branch, it was added new models (entities): Author, Book and Publisher, also it was created one class named IdEntity who has the Id attribute, its assessors and the implementation to equals and hashcode.
It was created in three repositories to manipulate data to the models previously created. How I'm using H2 as the database (in memory ), I created a bootstrap class to populate data when the application is starting.
Finally, to get access from the H2 database console, it was put spring.h2.console.enabled=true
in the configurations.
In this branch, it was added to the first steps using Thymeleaf to create the first HTML pages: books and authors. To manage this pages, it was created the controllers named BookController and AuthorController. The controllers are classes annotated with @Controller
and each controller has a method annotated with @RequestMapping
where is specified the name of the action called by request. These methods populate attributes who are sent to in the HTML pages.
In this branch, it was added some examples of how to use DI (Dependency Injection). It was shown three ways to do this:
HelloControllerProperty
: using the annotation@Autowired
on the property.HelloControllerSetter
: using the annotation@Autowired
in the setter.HelloControllerConstructor
: the annotation@Autowired
is optional if the constructor is used. It is the recommended way.
All the controller are annotated with @Controller
, where each controller has a @Service
property and both annotations come from @Component
.
These three first controllers are using the EasyGreetingService
because it's annotated with @Primary
.
The fourth called it was to HelloControllerConstructorAndQualifier
, this controller is using the @Qualifier("hardGreetingService")
to say what implementation should be used, different from the others controllers previously created.
Then I have created a controller called ProfileController
to show how the annotation @Profile
can read the application.properties and choose a specific service. The default word was used if the properties doen't specify what profile to use.
In this branch, it was added a sample controller to print a random quote when the joke we page is visited.
In this branch, it was added a type of spring conguration using annotation in the ChuckNorrisConfig class.
In this branch, it was added a type of spring conguration using xml in the chuck-config file.
In this branch, it was added one way to read a property file called fake.properties.
In this branch, it was added a way to read properties from multi files.
In this branch, it was added the start source of Recipe APP. Basically, it was mapped to the models, services, repositories and one controller to show recipes.
In this branch, it was added Bootstrap css using cdn and changing the index page to use it.
In this branch, it was added Some examples using tests.
In this branch, it was added web-jars to Bootstrap CSS and JQuery.
In this branch, it was added a view to show the details about a recipe using TDD.