As seguintes extensões do Visual Studio Code deverão estar instaladas:
Maven for Java (Microsoft)
Debugger for Java (Microsoft)
Java Test Runner (Microsoft)
Language Support for Java (Red Hat)
Java Extension Pack (Microsoft)
Java Dependency Viewer (Microsoft)
Spring Boot Extension Pack (Pivotal)
Lombok Annotations Support
REST Client
Docker instalado e configurado
Criar o seguinte container Docker: docker run -d -p 1521:1521 -p 8080:8080 wnameless/oracle-xe-11g-r2
Fazer o download e instalação do seguinte driver JDBC - ojdbc7.jar
mvn install:install-file -Dfile="ojdbc7.jar" -DgroupId="com.oracle" -DartifactId="ojdbc7" -Dversion="12.1.0" -Dpackaging=jar
- https://maven.apache.org/download.cgi -> Instalar a versão 3.6.3
- Caso esteja utilizando Windows vc poderá fazer a instalação do Maven via Chocolatey (Package Manager para Windows):
• https://chocolatey.org/
• https://chocolatey.org/packages/maven
Instalar O SQL Developer e fazer o teste de conexão com o Oracle database XE 11G que esta sendo executado no container Docker.
hostname: localhost
port: 1521
sid: xe
username: system
password: oracle
CREATE USER tenant1 IDENTIFIED BY 123456;
GRANT CONNECT,RESOURCE,DBA TO tenant1;
GRANT UNLIMITED TABLESPACE TO tenant1;
CREATE USER tenant2 IDENTIFIED BY 123456;
GRANT CONNECT,RESOURCE,DBA TO tenant2;
GRANT UNLIMITED TABLESPACE TO tenant2;
https://projectlombok.org/
https://projectlombok.org/features/Data
https://projectlombok.org/features/GetterSetter
https://www.projectlombok.org/features/Builder
https://projectlombok.org/features/constructor
@Configuration
É uma annotation que indica que determinada classe possui métodos que expõe novos beans.
@Controller
Associada com classes que possuem métodos que processam requests numa aplicação web.
@Repository
Anotação que serve para definir uma classe como pertencente à camada de persistência.
@Service
Anotação que serve para definir uma classe como pertencente à camada de Serviço da aplicação.
@Autowired
A anotação @ Autowired fornece controle sobre onde e como a ligação entre os beans deve ser realizada. Pode ser usado para em métodos setter, no construtor, em uma propriedade ou métodos com nomes arbitrários e / ou vários argumentos.
You can use the Interceptor in Spring Boot to perform operations under the following situations −
Before sending the request to the controller
Before sending the response to the client
The following are the three methods you should know about while working on Interceptors −
preHandle() method − This is used to perform operations before sending the request to the controller. This method should return true to return the response to the client.
postHandle() method − This is used to perform operations before sending the response to the client.
afterCompletion() method − This is used to perform operations after completing the request and response.
https://www.tutorialspoint.com/spring_boot/spring_boot_interceptor.htm
https://www.baeldung.com/java-threadlocal
https://fizzylogic.nl/2016/01/24/make-your-spring-boot-application-multi-tenant-aware-in-2-steps/
https://github.com/wmeints/spring-multi-tenant-demo
https://www.baeldung.com/spring-abstract-routing-data-source
https://github.com/Cepr0/sb-multitenant-db-demo