Skip to content

Commit 11f19e9

Browse files
authored
Update Spring CLI (#170)
1 parent 945ea3d commit 11f19e9

File tree

24 files changed

+349
-184
lines changed

24 files changed

+349
-184
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ build/
4242
.run
4343
target/
4444
Thumbs.db
45+
run-app.sh

database/spring-cli/catalog/project-catalog.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.
Binary file not shown.

database/spring-cli/projects/obaas/.mvn/wrapper/maven-wrapper.properties

Lines changed: 0 additions & 2 deletions
This file was deleted.

database/spring-cli/projects/obaas/README.adoc

Lines changed: 0 additions & 72 deletions
This file was deleted.

database/spring-cli/projects/obaas/src/main/java/com/example/restservice/greeting/Greeting.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

database/spring-cli/projects/obaas/src/test/java/com/example/restservice/greeting/GreetingControllerTests.java

Lines changed: 0 additions & 52 deletions
This file was deleted.

spring-cli/README .md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Spring CLI integration
2+
3+
Spring CLI integration with a project catalog to help you create Spring Boot projects using Oracle and [Oracle Backend for Microservices and AI](https://bit.ly/OracleAI-microservices).
4+
5+
## Install Spring CLI
6+
7+
The goal of the Spring CLI is to increase your productivity when you create new projects and when you add functionality to existing projects. [Spring CLI documentation](https://docs.spring.io/spring-cli/reference/index.html) describes how to install the CLI on various platforms.
8+
9+
## Add to Spring CLI
10+
11+
Execute the following command to add the `project-catalog` for [Oracle Backend for Microservices and AI](https://bit.ly/OracleAI-microservices).
12+
13+
```shell
14+
spring project-catalog add --name obaas --url https://github.com/oracle/spring-cloud-oracle/tree/main/spring-cli/catalog
15+
```
16+
17+
The Spring CLI is now aware of the [Oracle Backend for Microservices and AI](https://bit.ly/OracleAI-microservices) integration.
18+
19+
## Create project
20+
21+
To create a new project use the following command (there are more options available):
22+
23+
```shell
24+
spring boot new --from obaas --name myproject
25+
```
26+
27+
## Run the Spring CLI application locally
28+
29+
To run the application locally you need access to an Oracle Database (remotely or locally). Create a shell script with the following content called `run-app.sh` and set the values for the variables to reflect your environment.
30+
31+
```shell
32+
#!/bin/bash
33+
export spring_datasource_url=<URL to database>
34+
export liquibase_datasource_username=<Liquibase database user>
35+
export liquibase_datasource_password=<Liquibase database user password>
36+
export spring_datasource_username=<Application database user>
37+
export spring_datasource_password=<Application database user password>
38+
export otel_exporter_otlp_endpoint=http://localhost:8080 # Dummy URL
39+
./mvnw spring-boot:run -Dspring-boot.run.profiles=local
40+
```
41+
42+
The Spring profile `local` turns off Eureka discovery and OTLP tracing.
43+
44+
Execute the shell script running the following command:
45+
46+
```shell
47+
source run-app.sh
48+
```
49+
50+
You can see a few `WARNINGS` with this message which can be ignored:
51+
52+
```log
53+
WARNING:
54+
55+
Liquibase detected the following invalid LIQUIBASE_* environment variables:
56+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
project-repositories:
3+
- name: "obaas"
4+
description: "RESTful Greeting service for Oracle Backend Microservices and AI"
5+
url: "https://github.com/oracle/spring-cloud-oci/tree/main/spring-cli/projects/obaas"
6+
tags:
7+
- "obaas"
8+
- "java-17"
9+
- "rest"
10+
- "web"
11+
- "boot-3.4.x"

0 commit comments

Comments
 (0)