We're excited to announce the general availability of Graal Cloud Native 4 based on the recently launched Micronaut® framework 4!
Graal Cloud Native (GCN) is an Oracle build of the open source Micronaut framework. GCN provides a curated set of Micronaut framework modules that simplify cloud application development, are designed to be compiled ahead-of-time with GraalVM Native Image, and are fully supported by Oracle. GCN enables you to easily build portable cloud native Java microservices that start instantly and use fewer resources to reduce compute costs.
What's new in GCN 4?
Let's look at some of the notable changes in this release.
GCN BOM 2.0
We have a new bill of materials (BOM) 2.0 consisting of specific versions of Micronaut framework 4 modules and their dependencies that are compatible and tested together. This reduces the risk of library incompatibility and version mismatches, and saves you from having to test and figure this out yourself.
Include the BOM in your build files using:
Gradle:
dependencies {
micronautBoms(platform("cloud.graal.gcn:gcn-bom:2.0"))
...
}
Maven:
<dependency>
<groupId>cloud.graal.gcn</groupId>
<artifactId>gcn-bom</artifactId>
<version>2.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Java 17
GCN 4 is designed and tested to work with Java 17 and later versions.
Gradle 8
If you use Gradle to build your GCN applications, Gradle 8 is the minimum version required to work with GCN 4.
Micronaut Serialization
Micronaut Serialization is a fully featured compile-time replacement for Jackson and is now the default in GCN and Micronaut framework 4. Micronaut Serialization provides reflection-free, fast and secure JSON serialization/deserialization APIs whilst maintaining API compatibility with Jackson annotations.
Shown below is an example of including Micronaut Serialization in your build files for GCN 4 vs GCN 3.8.5:
GCN 4 - Gradle:
dependencies {
...
implementation("io.micronaut.serde:micronaut-serde-jackson")
...
}
GCN 3.8.5 - Gradle:
dependencies {
...
implementation("io.micronaut:micronaut-jackson-databind")
...
}
GCN 4 - Maven:
<dependency>
<groupId>io.micronaut.serde</groupId>
<artifactId>micronaut-serde-jackson</artifactId>
<scope>compile</scope>
</dependency>
GCN 3.8.5 - Maven:
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-jackson-databind</artifactId>
<scope>compile</scope>
</dependency>
GraalVM Integration
GCN 4 modules have been designed and tested to work with the latest release of Oracle GraalVM for JDK 17 Native Image available under the GraalVM Free Terms and Conditions (GFTC) license.
The reachability metadata of GCN and Micronaut framework 4 modules and their dependencies is stored in the shared GraalVM Reachability Metadata repository and these modules have been listed on the Libraries and Frameworks Tested with Native Image page. GCN and Micronaut framework 4’s GraalVM integration has been reworked to use this shared metadata repository using the Micronaut Maven and Gradle plugins and GraalVM Native Build Tools. This makes it extremely simple for you to compile your GCN application into a native executable with GraalVM Native Image.
Application Configuration Files
Micronaut framework 4 no longer exposes SnakeYAML as a transitive dependency. So, by default, GCN 4 uses properties files instead of YAML files for application configuration. This reduces the attack surface of your applications by eliminating an external (SnakeYAML) library.
Shown below is an example of an application configuration file for GCN 4 vs GCN 3.8.5:
GCN 4 - Properties File:
micronaut.application.name=dbDemo
flyway.datasources.default.enabled=true
datasources.default.db-type=mysql
datasources.default.dialect=MYSQL
datasources.default.driver-class-name=com.mysql.cj.jdbc.Driver
GCN 3.8.5 - YAML File:
micronaut:
application:
name: dbDemo
flyway:
datasources:
default:
enabled: true
datasources:
default:
db-type: mysql
dialect: MYSQL
driver-class-name: com.mysql.cj.jdbc.Driver
Javax to Jakarta Transition
Micronaut framework 4 has finished the Javax to Jakarta transition. So, GCN uses jakarta.validation instead of javax.validation, jakarta.mail instead of javax.mail, jakarta.transaction instead of javax.transaction, and so on.
Shown below are some examples of GCN 4 vs GCN 3.8.5:
GCN 4:
import jakarta.validation.Valid;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.transaction.Transactional;
GCN 3.8.5:
import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.transaction.Transactional;
Improved Modularity
Micronaut framework 4 is more modular enabling you to deploy even smaller microservices with reduced native executable and container image sizes, and faster startup. The built-in Validation, Retry, Service Discovery, HTTP Session and WebSocket features have been split into separate modules enabling you to remove this functionality if not needed.
Shown below is an example of using Micronaut Validation in your build files for GCN 4:
GCN 4 - Gradle:
annotationProcessor("io.micronaut.validation:micronaut-validation-processor")
implementation("io.micronaut.validation:micronaut-validation")
GCN 4 - Maven:
<annotationProcessorPaths>
<path>
<groupId>io.micronaut.validation</groupId>
<artifactId>micronaut-validation-processor</artifactId>
</path>
</annotationProcessorPaths>
...
...
<dependency>
<groupId>io.micronaut.validation</groupId>
<artifactId>micronaut-validation</artifactId>
</dependency>
Cloud Modules
GCN and Micronaut framework 4 contain cloud modules with improved support for Oracle Cloud. The Oracle Cloud SDK has been enhanced to be compatible with Micronaut Serialization improving the speed and security of requests and responses by eliminating the need for Jackson. The transport layer for the Oracle Cloud SDK has also been replaced with Netty, avoiding the need for a second HTTP client (Jersey) when writing applications, resulting in smaller container images and improved startup performance. You can also use the new Oracle Cloud Infrastructure Certificates service module to configure and manage HTTPS certificates with automatic refresh of expired certificates.
Object Storage adds Local Storage to ease local development and testing.
GCN Launcher and Guides
GCN VS Code Tooling
With this release, we have made several changes to the Visual Studio Code tooling for Graal Cloud Native.
The GCN VS Code Tools have their own home page, https://www.graal.cloud/gcn/vscode-tools/. Here, you can access the documentation, guides, and watch a video of the tooling in action.
We now support creating and working with Graal Cloud Native 4.0 and Micronaut 4.0 projects.
We've added a Bean and Endpoints explorer view for Micronaut, that also lets you run REST requests against endpoints from within the IDE.
We've added a CodeLens for 'Run in Continuous' mode. When you update a running Micronaut application launched from the CodeLens, the application is rebuilt and runs automatically, improving the overall developer experience.
Finally, we have released our database tooling that enables you to create Micronaut Data classes directly from an existing database schema (Oracle Autonomous Database). This feature makes it super easy to expose existing databases programmatically through GCN and Micronaut applications!
JSON Relational Duality Views
The latest version of Micronaut Data JDBC comes with support for Oracle Database 23c and JSON Relational Duality Views. JSON Relational Duality Views provides the benefits of both relational tables and JSON documents, without the trade-offs of either approach.
Other Changes
GCN 4 includes several other notable Micronaut framework 4 features including, Early support for Virtual Threads (Project Loom) with JDK 19 and later, Optimized Netty-based HTTP layer for Virtual Threads, Improved HTTP performance (up to 50% better throughput), experimental support for HTTP/3 and IO_Uring, and a new compile-time expression language (EL).
Source: oracle.com
0 comments:
Post a Comment