Skip to content

chrisp1985/EmployeeService

Repository files navigation

Employee API Service

Background

This is a repo to exercise some Spring framework stuff.

Useful Stuff

Rest Controller

  • The controller pulls data from an RDS MySQL DB, the setup scripts can be found in the resources section.
  • There is also Spring Rest Data enabled, which means all the endpoints using the entity names are active.
  • The Employee entity being available means that the endpoint at /employees is automatically created, with all the HATEOAS stuff that goes with it.

Repositories

  • The extension of the JpaRepository allows for all the DAO stuff to be automatically available, so using repository.save(), repository.findAll() etc for each of the CRUD functions.

Caching

  • @EnableCaching on the Main application sets the capability, then @Cacheable on a method means caching is available for that method and @CacheEvict means it'll be cleared when the method is triggered.

Actuator

  • /health and /info metrics are available through the /actuator endpoint.

AOP

  • Aspects are set up to trigger when cache is evicted.
  • The pattern can be copied for other annotations, or set via 'execution(* *.methodName(..))' to allow for any params to be passed to a method of method name in any package and with any return type.

Spring Boot Starter readme contents below...


Getting Started

Reference Documentation

For further reference, please consider the following sections:

Guides

The following guides illustrate how to use some features concretely:

Additional Links

These additional references should also help you:

Testcontainers support

This project uses Testcontainers at development time.

Testcontainers has been configured to use the following Docker images:

Please review the tags of the used images and set them to the same as you're running in production.

About

A test project to look at Spring Web and Spring Data with JPA.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published