Skip to content

Commit ee011de

Browse files
committed
Samples update
1 parent 2aeb366 commit ee011de

File tree

19 files changed

+80
-182
lines changed

19 files changed

+80
-182
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
springdoc:
22
version: '@springdoc.version@'
3+
enable-native-support: true
34
swagger-ui:
45
use-root-path: true

demo-oauth2/oauth-resource-server-webflux/pom.xml

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
<groupId>com.h2database</groupId>
2727
<artifactId>h2</artifactId>
2828
</dependency>
29+
<dependency>
30+
<groupId>org.springframework.boot</groupId>
31+
<artifactId>spring-boot-starter-validation</artifactId>
32+
</dependency>
2933
<!-- OpenAPI 3 -->
3034
<dependency>
3135
<groupId>org.springdoc</groupId>

demo-oauth2/oauth-resource-server-webmvc/pom.xml

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
<groupId>com.h2database</groupId>
2727
<artifactId>h2</artifactId>
2828
</dependency>
29+
<dependency>
30+
<groupId>org.springframework.boot</groupId>
31+
<artifactId>spring-boot-starter-validation</artifactId>
32+
</dependency>
2933
<!-- OpenAPI 3 -->
3034
<dependency>
3135
<groupId>org.springdoc</groupId>

demo-oauth2/pom.xml

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
<dependency>
2020
<groupId>io.rest-assured</groupId>
2121
<artifactId>rest-assured</artifactId>
22-
<version>4.5.0</version>
2322
<scope>test</scope>
2423
</dependency>
2524
</dependencies>
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
springdoc.version= @springdoc.version@
1+
springdoc.version= @springdoc.version@
2+
springdoc.enable-native-support=true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package org.springdoc.demo.app4;
2+
3+
import java.util.Arrays;
4+
5+
import org.springdoc.demo.app4.AppNativeConfiguration.AppNativeRuntimeHints;
6+
import org.springdoc.demo.app4.coffee.CoffeeService;
7+
import org.springdoc.demo.app4.employee.EmployeeRepository;
8+
9+
import org.springframework.aot.hint.MemberCategory;
10+
import org.springframework.aot.hint.RuntimeHints;
11+
import org.springframework.aot.hint.RuntimeHintsRegistrar;
12+
import org.springframework.context.annotation.Configuration;
13+
import org.springframework.context.annotation.ImportRuntimeHints;
14+
15+
/**
16+
* @author bnasslahsen
17+
*/
18+
@Configuration
19+
@ImportRuntimeHints(AppNativeRuntimeHints.class)
20+
public class AppNativeConfiguration {
21+
22+
static Class[] applicationClasses={org.springdoc.demo.app4.user.User[].class,
23+
org.springdoc.demo.app4.employee.Employee[].class,
24+
org.springdoc.demo.app4.coffee.Coffee[].class,
25+
org.springdoc.demo.app4.coffee.CoffeeOrder[].class,
26+
EmployeeRepository.class,
27+
CoffeeService.class
28+
};
29+
30+
static class AppNativeRuntimeHints implements RuntimeHintsRegistrar {
31+
32+
@Override
33+
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
34+
Arrays.stream(applicationClasses).forEach(applicationClass ->
35+
hints.reflection().registerType(applicationClass,
36+
(hint) -> hint.withMembers(MemberCategory.DECLARED_FIELDS,
37+
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
38+
MemberCategory.INVOKE_DECLARED_METHODS)));
39+
}
40+
}
41+
42+
}

demo-spring-boot-3-webflux-functional/src/main/resources/application.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ server:
99
enabled: true
1010
springdoc:
1111
version: '@springdoc.version@'
12+
enable-native-support: true
1213
swagger-ui:
1314
use-root-path: true

demo-spring-boot-3-webflux/README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ mvn clean spring-boot:build-image
2222
```
2323

2424
### Option 3: Building native image with GraalVM
25-
To create a `native image`, the project rely on spring-native project and buildpacks.
26-
Run the following command
25+
To create a `native image`, Run the following command
2726

2827
```sh
29-
mvn -Pnative-image clean spring-boot:build-image
28+
mvn -Pnative clean package
3029
```
3130

3231
## Running the native application

demo-spring-boot-3-webflux/src/main/resources/application.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ server:
1010
port: 8082
1111
springdoc:
1212
version: '@springdoc.version@'
13+
enable-native-support: true
1314
swagger-ui:
1415
use-root-path: true

demo-spring-boot-3-webmvc/README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ mvn clean spring-boot:build-image
2222
```
2323

2424
### Option 3: Building native image with GraalVM
25-
To create a `native image`, the project rely on spring-native project and buildpacks.
26-
Run the following command
25+
To create a `native image`, Run the following command
2726

2827
```sh
29-
mvn -Pnative-image clean spring-boot:build-image
28+
mvn -Pnative clean package
3029
```
3130

3231
## Running the native application

demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiController.java

+2
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,6 @@ public PetApiDelegate getDelegate() {
3939
return delegate;
4040
}
4141

42+
43+
4244
}

demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiDelegateImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private static Pet createPet(long id, Category category, String name, String[] u
7272
}
7373

7474
@PostConstruct
75-
private void initPets() {
75+
public void initPets() {
7676
Category dogs = new Category().id(1L).name("Dogs");
7777
Category cats = new Category().id(2L).name("Cats");
7878
Category rabbits = new Category().id(3L).name("Rabbits");

demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiDelegateImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private static Order createOrder(long id, long petId, Order.StatusEnum status) {
5858
}
5959

6060
@PostConstruct
61-
void initOrders() {
61+
public void initOrders() {
6262
orderRepository.save(createOrder(1, 1, Order.StatusEnum.PLACED));
6363
orderRepository.save(createOrder(2, 1, Order.StatusEnum.DELIVERED));
6464
orderRepository.save(createOrder(3, 2, Order.StatusEnum.PLACED));

demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiDelegateImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private static User createUser(long id, String username, String firstName, Strin
5454
}
5555

5656
@PostConstruct
57-
private void initUsers() {
57+
public void initUsers() {
5858
userRepository.save(createUser(1, "user1", "first name 1", "last name 1",
5959
"email1@test.com", 1));
6060
userRepository.save(createUser(2, "user2", "first name 2", "last name 2",

demo-spring-boot-3-webmvc/src/main/resources/application.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ springdoc:
1717
group-configs:
1818
- group: stores
1919
paths-to-match: /store/**
20+
enable-native-support: true
2021
server:
2122
port: 8081

demo-spring-data-rest/pom.xml

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
<groupId>org.springdoc</groupId>
3434
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
3535
</dependency>
36+
<dependency>
37+
<groupId>org.springframework.boot</groupId>
38+
<artifactId>spring-boot-starter-validation</artifactId>
39+
</dependency>
3640
</dependencies>
3741

3842
</project>
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
springdoc.version= @springdoc.version@
2-
springdoc.swagger-ui.use-root-path=true
2+
springdoc.swagger-ui.use-root-path=true
3+
springdoc.enable-native-support=true
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
spring.hateoas.use-hal-as-default-json-media-type= false
22
springdoc.swagger-ui.operationsSorter=method
33
springdoc.version= @springdoc.version@
4-
springdoc.swagger-ui.use-root-path=true
4+
springdoc.swagger-ui.use-root-path=true
5+
springdoc.enable-native-support=true

0 commit comments

Comments
 (0)