Skip to content

Commit 3431136

Browse files
authored
Spring boot 4 and Lagchain4j 1.15.0 upgrade
2 parents 7c55066 + 264b86b commit 3431136

85 files changed

Lines changed: 1437 additions & 737 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
mvnw text eol=lf
1+
/mvnw text eol=lf
2+
*.cmd text eol=crlf
23
*.java text eol=lf
34

45
/gradlew text eol=lf

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ out/
4242
### VS Code ###
4343
.vscode/
4444

45-
### SDK Man ###
46-
.sdkmanrc
47-
4845
### CSS ###
4946
_site/
5047
**/.DS_Store
Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
# Licensed to the Apache Software Foundation (ASF) under one
2-
# or more contributor license agreements. See the NOTICE file
3-
# distributed with this work for additional information
4-
# regarding copyright ownership. The ASF licenses this file
5-
# to you under the Apache License, Version 2.0 (the
6-
# "License"); you may not use this file except in compliance
7-
# with the License. You may obtain a copy of the License at
8-
#
9-
# https://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing,
12-
# software distributed under the License is distributed on an
13-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
# KIND, either express or implied. See the License for the
15-
# specific language governing permissions and limitations
16-
# under the License.
17-
wrapperVersion=3.3.2
1+
wrapperVersion=3.3.4
182
distributionType=only-script
19-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
3+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ Switching between LLM is done using **Maven profiles**. Three Maven profiles are
6363
2. `azure-openai`
6464
3. `ollama`
6565

66-
By default, thanks to the default `openai` profile, the `langchain4j-open-ai-spring-boot-starter` dependency is enabled.
67-
You can change it to `langchain4j-azure-open-ai-spring-boot-starter` or `langchain4j-ollama-spring-boot-starter` by activating the corresponding profile.
66+
By default, thanks to the default `openai` profile, the `langchain4j-open-ai-spring-boot4-starter` dependency is enabled.
67+
You can change it to `langchain4j-azure-open-ai-spring-boot-starter` or `langchain4j-ollama-spring-boot4-starter` by activating the corresponding profile.
6868
```shell
6969
./mvnw package -P azure-openai
7070
```
7171
`in either`pom.xml` or in `build.gradle`, depending on your build tool of choice.
7272

7373
#### Gradle build
7474

75-
Gradle users will need to comment or uncomment the appropriate `dev.langchain4j:langchain4j-<llm>>-spring-boot-starter` dependency
75+
Gradle users will need to comment or uncomment the appropriate `dev.langchain4j:langchain4j-<llm>>-spring-boot4-starter` dependency
7676
in the `build.gradle` file, depending on the LLM provider they want to use.
7777

7878

@@ -110,10 +110,17 @@ ollama run llama3.1
110110
```
111111
By default, the Ollama REST API starts on `http://localhost:11434`. This URL is used in the `application.properties` file.
112112

113+
See the presentation here:
114+
[Spring Petclinic Sample Application (legacy slides)](https://speakerdeck.com/michaelisvy/spring-petclinic-sample-application?slide=20)
115+
116+
> **Note:** These slides refer to a legacy, pre–Spring Boot version of Petclinic and may not reflect the current Spring Boot–based implementation.
117+
> For up-to-date information, please refer to this repository and its documentation.
118+
113119

114120
## Run Petclinic locally
115121

116-
Spring Petclinic is a [Spring Boot](https://spring.io/guides/gs/spring-boot) application built using [Maven](https://spring.io/guides/gs/maven/) or [Gradle](https://spring.io/guides/gs/gradle/). You can build a jar file and run it from the command line (it should work just as well with Java 17 or newer):
122+
Spring Petclinic is a [Spring Boot](https://spring.io/guides/gs/spring-boot) application built using [Maven](https://spring.io/guides/gs/maven/) or [Gradle](https://spring.io/guides/gs/gradle/).
123+
Java 17 or later is required for the build, and the application can run with Java 17 or newer:
117124

118125
```bash
119126
git clone https://github.com/spring-petclinic/spring-petclinic-langchain4j.git
@@ -122,6 +129,8 @@ cd spring-petclinic
122129
java -jar target/*.jar
123130
```
124131

132+
(On Windows, or if your shell doesn't expand the glob, you might need to specify the JAR file name explicitly on the command line at the end there.)
133+
125134
You can then access the Petclinic at <http://localhost:8080/>.
126135

127136
![Screenshot of the Find Owners menu](docs/find-owners-screenshot.png)
@@ -157,13 +166,13 @@ A similar setup is provided for MySQL and PostgreSQL if a persistent database co
157166
You can start MySQL or PostgreSQL locally with whatever installer works for your OS or use docker:
158167

159168
```bash
160-
docker run -e MYSQL_USER=petclinic -e MYSQL_PASSWORD=petclinic -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:9.1
169+
docker run -e MYSQL_USER=petclinic -e MYSQL_PASSWORD=petclinic -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:9.5
161170
```
162171

163172
or
164173

165174
```bash
166-
docker run -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:17.0
175+
docker run -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:18.1
167176
```
168177

169178
Further documentation is provided for [MySQL](https://github.com/spring-petclinic/spring-petclinic-langchain4j/blob/main/src/main/resources/db/mysql/petclinic_db_setup_mysql.txt)
@@ -195,7 +204,7 @@ There is a `petclinic.css` in `src/main/resources/static/resources/css`. It was
195204

196205
The following items should be installed in your system:
197206

198-
- Java 17 or newer (full JDK, not a JRE)
207+
- Java 25 or newer (full JDK, not a JRE)
199208
- [Git command line tool](https://help.github.com/articles/set-up-git)
200209
- Your preferred IDE
201210
- Eclipse with the m2e plugin. Note: when m2e is available, there is an m2 icon in `Help -> About` dialog. If m2e is

build.gradle

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
plugins {
22
id 'java'
3-
id 'org.springframework.boot' version '3.4.2'
4-
id 'io.spring.dependency-management' version '1.1.6'
5-
// id 'org.graalvm.buildtools.native' version '0.10.3'
6-
id 'org.cyclonedx.bom' version '1.10.0'
7-
id 'io.spring.javaformat' version '0.0.43'
3+
id 'checkstyle'
4+
id 'org.springframework.boot' version '4.0.6'
5+
id 'io.spring.dependency-management' version '1.1.7'
6+
// id 'org.graalvm.buildtools.native' version '0.11.1'
7+
id 'org.cyclonedx.bom' version '3.0.2'
8+
id 'io.spring.javaformat' version '0.0.47'
89
id "io.spring.nohttp" version "0.0.11"
910
}
1011

@@ -15,24 +16,26 @@ apply plugin: 'io.spring.javaformat'
1516
// gradle.startParameter.excludedTaskNames += [ "checkFormatAot", "checkFormatAotTest" ]
1617

1718
group = 'org.springframework.samples'
18-
version = '3.4.0'
19+
version = '4.0.6'
1920

2021
java {
21-
sourceCompatibility = JavaVersion.VERSION_17
22+
toolchain {
23+
languageVersion = JavaLanguageVersion.of(17)
24+
}
2225
}
2326

2427
repositories {
2528
mavenCentral()
2629
maven { url 'https://repo.spring.io/milestone' }
2730
}
2831

29-
ext.checkstyleVersion = "10.20.1"
30-
ext.springJavaformatCheckstyleVersion = "0.0.43"
31-
ext.webjarsLocatorLiteVersion = "1.0.1"
32+
ext.checkstyleVersion = "12.1.2"
33+
ext.springJavaformatCheckstyleVersion = "0.0.47"
34+
ext.webjarsLocatorLiteVersion = "1.1.2"
3235
ext.webjarsFontawesomeVersion = "4.7.0"
33-
ext.webjarsBootstrapVersion = "5.3.3"
36+
ext.webjarsBootstrapVersion = "5.3.8"
3437
ext.webjarsMarkedVersion = "14.1.2"
35-
ext.langchain4jVersion = "1.9.1"
38+
ext.langchain4jVersion = "1.15.0"
3639

3740
dependencyManagement {
3841
imports {
@@ -41,18 +44,18 @@ dependencyManagement {
4144
}
4245

4346
dependencies {
44-
implementation "dev.langchain4j:langchain4j-spring-boot-starter"
45-
implementation "dev.langchain4j:langchain4j-open-ai-spring-boot-starter"
46-
// implementation "dev.langchain4j:langchain4j-azure-open-ai-spring-boot-starter"
47-
// implementation "dev.langchain4j:langchain4j-ollama-spring-boot-starter"
47+
implementation "dev.langchain4j:langchain4j-spring-boot4-starter"
48+
implementation "dev.langchain4j:langchain4j-open-ai-spring-boot4-starter"
49+
// implementation "dev.langchain4j:langchain4j-azure-open-ai-spring-boot4-starter"
50+
// implementation "dev.langchain4j:langchain4j-ollama-spring-boot4-starter"
4851
implementation "dev.langchain4j:langchain4j-embeddings-all-minilm-l6-v2"
4952
// Workaround for AOT issue (https://github.com/spring-projects/spring-framework/pull/33949) -->
5053
implementation 'io.projectreactor:reactor-core'
5154

5255
implementation 'org.springframework.boot:spring-boot-starter-cache'
5356
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
5457
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
55-
implementation 'org.springframework.boot:spring-boot-starter-web'
58+
implementation 'org.springframework.boot:spring-boot-starter-webmvc'
5659
implementation 'org.springframework.boot:spring-boot-starter-validation'
5760
implementation 'javax.cache:cache-api'
5861
implementation 'jakarta.xml.bind:jakarta.xml.bind-api'
@@ -66,12 +69,14 @@ dependencies {
6669
runtimeOnly 'com.mysql:mysql-connector-j'
6770
runtimeOnly 'org.postgresql:postgresql'
6871
developmentOnly 'org.springframework.boot:spring-boot-devtools'
69-
testImplementation 'org.springframework.boot:spring-boot-starter-test'
72+
testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa-test'
73+
testImplementation 'org.springframework.boot:spring-boot-starter-restclient-test'
74+
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
7075
testImplementation 'org.springframework.boot:spring-boot-testcontainers'
7176
testImplementation 'org.springframework.boot:spring-boot-docker-compose'
72-
testImplementation 'org.testcontainers:junit-jupiter'
73-
testImplementation 'org.testcontainers:mysql'
74-
testImplementation 'org.testcontainers:postgresql'
77+
testImplementation 'org.testcontainers:testcontainers-junit-jupiter'
78+
testImplementation 'org.testcontainers:testcontainers-mysql'
79+
testImplementation 'org.testcontainers:testcontainers-postgresql'
7580
checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:${springJavaformatCheckstyleVersion}"
7681
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
7782
}

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
mysql:
3-
image: mysql:9.1
3+
image: mysql:9.5
44
ports:
55
- "3306:3306"
66
environment:
@@ -12,7 +12,7 @@ services:
1212
volumes:
1313
- "./conf.d:/etc/mysql/conf.d:ro"
1414
postgres:
15-
image: postgres:17.0
15+
image: postgres:18.1
1616
ports:
1717
- "5432:5432"
1818
environment:

gradle/wrapper/gradle-wrapper.jar

2 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 4 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)