Skip to content

Commit

Permalink
Some improvements in Spring boot and Micronaut demos
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-s committed Nov 5, 2024
1 parent ba65fd7 commit f6c87be
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 7 deletions.
3 changes: 2 additions & 1 deletion graalpy/graalpy-javase-guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ Update the build script to pass the necessary Java property to the application:
`build.gradle.kts`
```
application {
applicationDefaultJvmArgs = listOf("-Dgraalpy.resources=./python-resources")
mainClass = "org.example.App"
applicationDefaultJvmArgs = listOf("-Dgraalpy.resources=" + System.getProperty("graalpy.resources"))
}
```

Expand Down
2 changes: 1 addition & 1 deletion graalpy/graalpy-micronaut-guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ The application will have a simple chat-like view, which takes text as input and

Create a html file, which will be later on rendered with the help of the `thymeleaf` library:

`resources/views/index.html`
`src/main/resources/views/index.html`
```html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
Expand Down
28 changes: 24 additions & 4 deletions graalpy/graalpy-spring-boot-guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ You can use [Spring Initializr](https://start.spring.io/) project generator to g

1. Navigate to https://start.spring.io/
2. GraalPy currently provides plugins for *Maven* and *Gradle*. You can select either one as the build system.
Note: in the Gradle case, this guide uses Groovy.
3. Click on **Dependencies** and select **Spring Web**
4. Click on **Dependencies** and select **Thymeleaf**
5. Click on **Generate**. Download and extract the generated ZIP file
Expand Down Expand Up @@ -116,12 +117,12 @@ Add the `graalpy-maven-plugin` configuration into the plugins section of the POM
`build.gradle`
```
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.5'
id 'io.spring.dependency-management' version '1.1.6'
id 'org.graalvm.python' version '24.1.1'
}
// ...
```

`build.gradle`
```
graalPy {
packages = [ // ①
'vader-sentiment==3.2.1.1', // ②
Expand Down Expand Up @@ -491,6 +492,25 @@ We will use GraalVM, the polyglot embeddable virtual machine, to generate a nati
Compiling native executables ahead of time with GraalVM improves startup time and reduces the memory footprint of JVM-based applications.

First, add the [`org.graalvm.buildtools`](https://graalvm.github.io/native-build-tools/latest/index.html) plugin for your build system.

For Maven:

`pom.xml`
```xml
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
</plugin>
```


For Gradle, add this to the `plugins` block:

`build.gradle`
```
id 'org.graalvm.buildtools.native' version '0.10.3'
```

Make sure that the `JAVA_HOME` environmental variable is set to the location of a GraalVM installation.
We recommend using a GraalVM 24.1.

Expand Down
4 changes: 3 additions & 1 deletion graalpy/graalpy-spring-boot-guide/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
plugins {
id 'org.graalvm.python' version '24.1.1'
// ...
id 'java'
id 'org.springframework.boot' version '3.3.5'
id 'io.spring.dependency-management' version '1.1.6'
id 'org.graalvm.python' version '24.1.1'
id 'org.graalvm.buildtools.native' version '0.10.3'
}

graalPy {
Expand Down
5 changes: 5 additions & 0 deletions graalpy/graalpy-spring-boot-guide/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.graalvm.python</groupId>
<artifactId>graalpy-maven-plugin</artifactId>
Expand Down

0 comments on commit f6c87be

Please sign in to comment.