@@ -82,8 +82,7 @@ its `ValidationProvider` implementation. In the case of Hibernate Validator, thi
82
82
83
83
Depending on your environment and its classloading specifics, provider discovery via the Java's
84
84
service loader mechanism might not work. In this case, you can plug in a custom
85
- `ValidationProviderResolver` implementation which performs the provider retrieval. An example is OSGi,
86
- where you could implement a provider resolver which uses OSGi services for provider discovery.
85
+ `ValidationProviderResolver` implementation which performs the provider retrieval.
87
86
88
87
To use a custom provider resolver, pass it via `providerResolver()` as shown in
89
88
<<example-using-custom-validation-provider-resolver>>.
@@ -93,7 +92,7 @@ To use a custom provider resolver, pass it via `providerResolver()` as shown in
93
92
====
94
93
[source, JAVA, indent=0]
95
94
----
96
- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/OsgiServiceDiscoverer .java[tags=include]
95
+ include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/CustomValidationProviderResolver .java[tags=include]
97
96
----
98
97
99
98
[source, JAVA, indent=0]
@@ -436,7 +435,7 @@ For constraints like `@ScriptAssert` and `@ParameterScriptAssert`, it might be u
436
435
how the script engines are initialized and how the script evaluators are built.
437
436
This can be done by setting a custom implementation of `ScriptEvaluatorFactory`.
438
437
439
- In particular, this is important for modular environments (e.g. OSGi) , where user might face issues
438
+ In particular, this is important for modular environments, where user might face issues
440
439
with modular class loading and https://www.jcp.org/en/jsr/detail?id=223[JSR 223].
441
440
It also allows to use any custom script engine, not necessarily based on the
442
441
https://www.jcp.org/en/jsr/detail?id=223[JSR 223] (e.g. Spring Expression Language).
@@ -487,7 +486,7 @@ To solve this issue, the `MultiClassLoaderScriptEvaluatorFactory` class below ca
487
486
====
488
487
[source, JAVA, indent=0]
489
488
----
490
- include::{osgi-integrationtest- sourcedir}/org/hibernate/validator/osgi/scripting /MultiClassLoaderScriptEvaluatorFactory.java[]
489
+ include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09 /MultiClassLoaderScriptEvaluatorFactory.java[]
491
490
----
492
491
====
493
492
@@ -496,33 +495,12 @@ and then declared with:
496
495
====
497
496
[source, JAVA, indent=0]
498
497
----
499
- include::{osgi-integrationtest- sourcedir}/org/hibernate/validator/osgi/integrationtest/OsgiIntegrationTest .java[tags=scriptEvaluatorFactoryMultiClassLoaderScriptEvaluatorFactory]
498
+ include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/BootstrappingTest .java[tags=scriptEvaluatorFactoryMultiClassLoaderScriptEvaluatorFactory]
500
499
----
501
500
====
502
501
503
502
This way, it is possible to pass multiple `ClassLoader` instances: typically the class loaders of the wanted ``ScriptEngine``s.
504
503
505
- An alternative approach for OSGi environments can be to use the `OsgiScriptEvaluatorFactory` defined below:
506
-
507
- ====
508
- [source, JAVA, indent=0]
509
- ----
510
- include::{osgi-integrationtest-sourcedir}/org/hibernate/validator/osgi/scripting/OsgiScriptEvaluatorFactory.java[]
511
- ----
512
- ====
513
-
514
- and then declared with:
515
-
516
- ====
517
- [source, JAVA, indent=0]
518
- ----
519
- include::{osgi-integrationtest-sourcedir}/org/hibernate/validator/osgi/integrationtest/OsgiIntegrationTest.java[tags=scriptEvaluatorFactoryOsgiScriptEvaluatorFactory]
520
- ----
521
- ====
522
-
523
- It is designed specifically for OSGi environments and allows you to pass the `BundleContext` which will be used to search
524
- for `ScriptEngineFactory` as a parameter.
525
-
526
504
As already mentioned, you can also use script engines that are not based on https://www.jcp.org/en/jsr/detail?id=223[JSR 223].
527
505
528
506
For instance, to use the https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#expressions[Spring Expression Language],
0 commit comments