Desarrollo
Abrimos nuestro sts y le damos en File->New->Spring Starter ProjectLlenamos los siguientes datos y presionamos Next
- Type: Maven
- Packaging: jar
- Java Version: 17(este dato se puede modificar una vez creado el pom.xml a la versión de java que desees utilizar
- Name: manager
- Group: com.tutosoftware.manager
- Artifact: manager
- Description: Api rest del Manager Activity
- Package: com.tutosoftware.manager
Nos pasa a la pantalla donde vamos a elgir las dependencias y elegimos las siguientes:
- Spring Boot DevTools
- Lombok
- Spring Data JPA
- Oracle Driver
- Validation
- Spring Web
El archivo pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.tutosoftware.manager</groupId>
<artifactId>manager</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>manager</name>
<description>Api rest del Manager Activity</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
El archivo application.properties queda de la siguiente forma:
spring.application.name=manager
server.port=8888
# OracleDB connection settings
spring.datasource.url=jdbc:oracle:thin:@//localhost:1521/orcl
spring.datasource.username=activity
spring.datasource.password=manager
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.jpa.properties.dialect=org.hibernate.dialect.Oracle12cDialect
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update