Skip to content

v2.3.0 #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c0330dd
Update dependency org.apache.maven.plugins:maven-gpg-plugin to v3.2.7
xdev-renovate Sep 28, 2024
40edee3
Update dependency com.puppycrawl.tools:checkstyle to v10.18.2
xdev-renovate Sep 30, 2024
c64c52e
Merge pull request #168 from xdev-software/master
JohannesRabauer Oct 1, 2024
2ce9319
Update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3…
xdev-renovate Oct 2, 2024
c6780b5
Merge pull request #103 from xdev-software/renovate/org.apache.maven.…
AB-xdev Oct 7, 2024
f4b4a6d
Merge pull request #102 from xdev-software/renovate/com.puppycrawl.to…
AB-xdev Oct 7, 2024
27ec7ab
Merge pull request #101 from xdev-software/renovate/org.apache.maven.…
AB-xdev Oct 7, 2024
1967712
Update lycheeverse/lychee-action action to v2
xdev-renovate Oct 9, 2024
0e0b2ff
Merge pull request #9 from xdev-software/renovate/lycheeverse-lychee-…
AB-xdev Oct 9, 2024
743c5c6
Merge branch 'master' into update-from-template-merged
xdev-gh-bot Oct 9, 2024
506ecb3
Make fields overrideable
AB-xdev Oct 10, 2024
c347c07
Fix sonar problems
AB-xdev Oct 10, 2024
1af5523
Add support for shuting down the storage during application shutdown
AB-xdev Oct 10, 2024
c420441
Bump version due to minor change
AB-xdev Oct 10, 2024
254289d
Add log message
AB-xdev Oct 11, 2024
c7edb21
Merge branch 'develop' into update-from-template-merged
xdev-gh-bot Oct 14, 2024
8ec5869
Update known-issues.adoc
JohannesRabauer Oct 14, 2024
32b7c61
Merge branch 'develop' into spring-boot-dev-tools-support
JohannesRabauer Oct 14, 2024
2a8c20c
Small refactor
JohannesRabauer Oct 14, 2024
52c3de8
Added documentation
JohannesRabauer Oct 14, 2024
bb98ddf
Fixed faulty behavior if classloader is not set for EclipseStore
JohannesRabauer Oct 14, 2024
7f4c971
Added the ClassLoaderProvider to the RegisteringCopier to react to Cl…
JohannesRabauer Oct 14, 2024
c5971f4
Update SpecialTypesTestConfiguration.java
JohannesRabauer Oct 14, 2024
c5bb33a
Added basic Constraints-support
JohannesRabauer Oct 15, 2024
54f11e4
Constraints now work with supplied validator
JohannesRabauer Oct 15, 2024
9a3c56b
Fixed Checkstyle and PMD
JohannesRabauer Oct 15, 2024
253927e
Merge branch 'develop' into spring-boot-dev-tools-support
JohannesRabauer Oct 16, 2024
7802037
Merge fix
JohannesRabauer Oct 16, 2024
f2cec3d
Merge pull request #172 from xdev-software/spring-boot-dev-tools-support
JohannesRabauer Oct 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/broken-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v1
uses: lycheeverse/lychee-action@v2

- name: Find already existing issue
id: find-issue
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 2.3.0

* Add support for shuting down the storage during application shutdown
* By default only enabled when Spring DevTools are active
* This should fix "StorageExceptionInitialization: Active storage for ... already exists" errors during DevTools restart
* Added [Jakarta Bean Validation Constraints](https://jakarta.ee/learn/docs/jakartaee-tutorial/current/beanvalidation/bean-validation/bean-validation.html#_using_jakarta_bean_validation_constraints) with Hibernate validator for entities.

# 2.2.2

* Fixed NPE in EclipseSerializerRegisteringCopier
Expand Down
6 changes: 3 additions & 3 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: ROOT
title: Spring-Data-Eclipse-Store
version: master
display_version: '2.2.2'
display_version: '2.3.0'
start_page: index.adoc
nav:
- modules/ROOT/nav.adoc
asciidoc:
attributes:
product-name: 'Spring-Data-Eclipse-Store'
display-version: '2.2.2'
maven-version: '2.2.2'
display-version: '2.3.0'
maven-version: '2.3.0'
page-editable: false
page-out-of-support: false
21 changes: 21 additions & 0 deletions docs/modules/ROOT/pages/configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,24 @@ public class DemoConfiguration extends EclipseStoreClientConfiguration
The method ``createEmbeddedStorageFoundation`` could return a much more complicated ``EmbeddedStorageFoundation`` as described here in the https://docs.eclipsestore.io/manual/storage/configuration/index.html[EclipseStore documentation about configuration and foundations].

This also enables you to use multiple EclipseStore-Storages in one project. See the https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage[Dual storages demo].

== Properties

In general properties from EclipseStore can be used.
See https://docs.eclipsestore.io/manual/storage/configuration/properties.html[EclipseStore - Properties].

Here the {product-name}-Properties are displayed (all must be prefixed with ``spring-data-eclipse-store``):

[cols="1,1"]
|===
|https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreClientConfiguration.java[context-close-shutdown-storage.enabled] [[context-close-shutdown-storage]]
| If enabled, the application listens to the ``ContextClosedEvent`` and shuts the storage down if the restart of the spring-dev-tools is enabled (see xref:known-issues.adoc#spring-dev-tools[Known issues] and https://docs.spring.io/spring-boot/api/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.Restart.html[DevToolProperties])

Default: ``true``

|https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreClientConfiguration.java[context-close-shutdown-storage.only-when-dev-tools]
|If this and ``context-close-shutdown-storage.enabled`` are true, the application listens to the ``ContextClosedEvent`` and shuts the storage down **only if** the spring-dev-tools are present in the ClassLoader (see xref:known-issues.adoc#spring-dev-tools[Known issues])

Default: ``true``


26 changes: 9 additions & 17 deletions docs/modules/ROOT/pages/known-issues.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,14 @@ This helps you keep your data up to date regardless of the current version.

We created https://github.com/xdev-software/spring-data-eclipse-store/issues/33[an issue] for that but right now we *do not support XDEVs MicroMigration*.

== Spring Developer Tools
== Spring Developer Tools [[spring-dev-tools]]

Using https://docs.spring.io/spring-boot/reference/using/devtools.html[Spring Developer Tools] (`spring-boot-devtools`) can lead to serious issues in your project.
That is manly due to the https://docs.spring.io/spring-boot/reference/using/devtools.html#using.devtools.livereload[LiveReload feature] and the usage of a "Restart Classloader".

This leads to problems within EclipseStore and can cause issues with discovering beans (https://github.com/spring-projects/spring-boot/issues/41011[Example Issue]).

If you must use the Spring Developer Tools, make sure to https://docs.spring.io/spring-boot/reference/using/devtools.html#using.devtools.restart.disable[disable restart].

[source,java,title="Example how to disable restart"]
----
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(MyApplication.class, args);
}
}
----
That is manly due to the https://docs.spring.io/spring-boot/reference/using/devtools.html#using.devtools.livereload[LiveReload feature] and the usage of a "Restart ClassLoader".
It derives from the https://docs.eclipsestore.io/manual/misc/integrations/spring-boot.html#_spring_dev_tools[issue with EclipseStore].

To mitigate this issue, {product-name} listens to the closing of the Spring-Context and shuts down the storage.
This **should** handle most problems with the ClassLoader.
Restarting the storage leads to a reloading of all entities and may take some time, yet circumvents the Restart ClassLoader Issue.

The behavior can be configured through xref:configuration.adoc#context-close-shutdown-storage[Properties] and is implemented in the https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreClientConfiguration.java[EclipseStoreClientConfiguration.java].
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>software.xdev</groupId>
<artifactId>spring-data-eclipse-store-root</artifactId>
<version>2.2.3-SNAPSHOT</version>
<version>2.3.0-SNAPSHOT</version>
<packaging>pom</packaging>

<organization>
Expand Down
4 changes: 2 additions & 2 deletions spring-data-eclipse-store-benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>software.xdev</groupId>
<artifactId>spring-data-eclipse-store-root</artifactId>
<version>2.2.3-SNAPSHOT</version>
<version>2.3.0-SNAPSHOT</version>
</parent>

<artifactId>spring-data-eclipse-store-benchmark</artifactId>
<version>2.2.3-SNAPSHOT</version>
<version>2.3.0-SNAPSHOT</version>
<packaging>jar</packaging>

<inceptionYear>2023</inceptionYear>
Expand Down
4 changes: 2 additions & 2 deletions spring-data-eclipse-store-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<parent>
<groupId>software.xdev</groupId>
<artifactId>spring-data-eclipse-store-root</artifactId>
<version>2.2.3-SNAPSHOT</version>
<version>2.3.0-SNAPSHOT</version>
</parent>

<artifactId>spring-data-eclipse-store-demo</artifactId>
<version>2.2.3-SNAPSHOT</version>
<version>2.3.0-SNAPSHOT</version>
<packaging>jar</packaging>

<organization>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.nio.file.Path;

import org.eclipse.serializer.reflect.ClassLoaderProvider;
import org.eclipse.store.integrations.spring.boot.types.configuration.EclipseStoreProperties;
import org.eclipse.store.integrations.spring.boot.types.factories.EmbeddedStorageFoundationFactory;
import org.eclipse.store.storage.embedded.types.EmbeddedStorage;
Expand All @@ -28,10 +29,11 @@ public class ComplexConfiguration extends EclipseStoreClientConfiguration
@Autowired
public ComplexConfiguration(
final EclipseStoreProperties defaultEclipseStoreProperties,
final EmbeddedStorageFoundationFactory defaultEclipseStoreProvider
final EmbeddedStorageFoundationFactory defaultEclipseStoreProvider,
final ClassLoaderProvider classLoaderProvider
)
{
super(defaultEclipseStoreProperties, defaultEclipseStoreProvider);
super(defaultEclipseStoreProperties, defaultEclipseStoreProvider, classLoaderProvider);
}

/**
Expand All @@ -45,7 +47,11 @@ public ComplexConfiguration(
@Override
public EmbeddedStorageFoundation<?> createEmbeddedStorageFoundation()
{
return EmbeddedStorage.Foundation(Storage.Configuration(Storage.FileProvider(Path.of(STORAGE_PATH))));
final EmbeddedStorageFoundation<?> storageFoundation =
EmbeddedStorage.Foundation(Storage.Configuration(Storage.FileProvider(Path.of(STORAGE_PATH))));
// This is only needed, if a different ClassLoader is used (e.g. when using spring-dev-tools)
storageFoundation.getConnectionFoundation().setClassLoaderProvider(this.getClassLoaderProvider());
return storageFoundation;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.nio.file.Path;

import org.eclipse.serializer.reflect.ClassLoaderProvider;
import org.eclipse.store.integrations.spring.boot.types.configuration.EclipseStoreProperties;
import org.eclipse.store.integrations.spring.boot.types.factories.EmbeddedStorageFoundationFactory;
import org.eclipse.store.storage.embedded.types.EmbeddedStorage;
Expand All @@ -23,15 +24,15 @@
@EnableEclipseStoreRepositories
public class PersistenceInvoiceConfiguration extends EclipseStoreClientConfiguration
{

public static final String STORAGE_PATH = "storage-invoice";

@Autowired
protected PersistenceInvoiceConfiguration(
final EclipseStoreProperties defaultEclipseStoreProperties,
final EmbeddedStorageFoundationFactory defaultEclipseStoreProvider)
final EmbeddedStorageFoundationFactory defaultEclipseStoreProvider,
final ClassLoaderProvider classLoaderProvider)
{
super(defaultEclipseStoreProperties, defaultEclipseStoreProvider);
super(defaultEclipseStoreProperties, defaultEclipseStoreProvider, classLoaderProvider);
}

/**
Expand All @@ -45,6 +46,10 @@ protected PersistenceInvoiceConfiguration(
@Override
public EmbeddedStorageFoundation<?> createEmbeddedStorageFoundation()
{
return EmbeddedStorage.Foundation(Storage.Configuration(Storage.FileProvider(Path.of(STORAGE_PATH))));
final EmbeddedStorageFoundation<?> storageFoundation =
EmbeddedStorage.Foundation(Storage.Configuration(Storage.FileProvider(Path.of(STORAGE_PATH))));
// This is only needed, if a different ClassLoader is used (e.g. when using spring-dev-tools)
storageFoundation.getConnectionFoundation().setClassLoaderProvider(getClassLoaderProvider());
return storageFoundation;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package software.xdev.spring.data.eclipse.store.demo.dual.storage.person;

import org.eclipse.serializer.reflect.ClassLoaderProvider;
import org.eclipse.store.integrations.spring.boot.types.configuration.ConfigurationPair;
import org.eclipse.store.integrations.spring.boot.types.configuration.EclipseStoreProperties;
import org.eclipse.store.integrations.spring.boot.types.factories.EmbeddedStorageFoundationFactory;
Expand Down Expand Up @@ -31,9 +32,10 @@ public class PersistencePersonConfiguration extends EclipseStoreClientConfigurat
public PersistencePersonConfiguration(
final EclipseStoreProperties defaultEclipseStoreProperties,
final EmbeddedStorageFoundationFactory defaultEclipseStoreProvider,
final EclipseStoreProperties properties)
final EclipseStoreProperties properties,
final ClassLoaderProvider classLoaderProvider)
{
super(defaultEclipseStoreProperties, defaultEclipseStoreProvider);
super(defaultEclipseStoreProperties, defaultEclipseStoreProvider, classLoaderProvider);
this.foundation = defaultEclipseStoreProvider;
this.properties = properties;
}
Expand Down
4 changes: 2 additions & 2 deletions spring-data-eclipse-store-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<parent>
<groupId>software.xdev</groupId>
<artifactId>spring-data-eclipse-store-root</artifactId>
<version>2.2.3-SNAPSHOT</version>
<version>2.3.0-SNAPSHOT</version>
</parent>

<artifactId>spring-data-eclipse-store-jpa</artifactId>
<version>2.2.3-SNAPSHOT</version>
<version>2.3.0-SNAPSHOT</version>
<packaging>jar</packaging>

<inceptionYear>2023</inceptionYear>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.nio.file.Path;

import org.eclipse.serializer.reflect.ClassLoaderProvider;
import org.eclipse.store.integrations.spring.boot.types.configuration.EclipseStoreProperties;
import org.eclipse.store.integrations.spring.boot.types.factories.EmbeddedStorageFoundationFactory;
import org.springframework.beans.factory.DisposableBean;
Expand Down Expand Up @@ -45,9 +46,10 @@ public class TestConfiguration extends EclipseStoreClientConfiguration implement
@Autowired
protected TestConfiguration(
final EclipseStoreProperties defaultEclipseStoreProperties,
final EmbeddedStorageFoundationFactory defaultEclipseStoreProvider)
final EmbeddedStorageFoundationFactory defaultEclipseStoreProvider,
final ClassLoaderProvider classLoaderProvider)
{
super(defaultEclipseStoreProperties, defaultEclipseStoreProvider);
super(defaultEclipseStoreProperties, defaultEclipseStoreProvider, classLoaderProvider);
}

@EventListener
Expand Down
39 changes: 37 additions & 2 deletions spring-data-eclipse-store/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>software.xdev</groupId>
<artifactId>spring-data-eclipse-store</artifactId>
<version>2.2.3-SNAPSHOT</version>
<version>2.3.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>spring-data-eclipse-store</name>
Expand Down Expand Up @@ -54,6 +54,10 @@
<org.springframework.boot.version>3.3.4</org.springframework.boot.version>
<org.eclipse.store.version>1.4.0</org.eclipse.store.version>
<org.eclipse.serializer.version>1.4.0</org.eclipse.serializer.version>
<hibernate-validator.version>8.0.1.Final</hibernate-validator.version>
<jakarta.el-api.version>6.0.1</jakarta.el-api.version>
<expressly.version>6.0.0-M1</expressly.version>
<hibernate-core.version>6.6.1.Final</hibernate-core.version>
</properties>

<repositories>
Expand Down Expand Up @@ -164,6 +168,37 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate-core.version}</version>
<exclusions>
<exclusion>
<artifactId>antlr4-runtime</artifactId>
<groupId>org.antlr</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<version>${jakarta.el-api.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.expressly</groupId>
<artifactId>expressly</artifactId>
<version>${expressly.version}</version>
</dependency>

<dependency>
<groupId>com.googlecode.cqengine</groupId>
Expand Down Expand Up @@ -288,7 +323,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.10.0</version>
<version>3.10.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public EclipseStoreDataImporter(final EclipseStoreClientConfiguration configurat
{
this.configuration = configuration;
}

/**
* Imports entities from all given {@link EntityManagerFactory}s that are available into the EclipseStore storage.
* <p>
Expand Down Expand Up @@ -265,7 +265,9 @@ private <T> void createRepositoryForType(
storageInstance,
storageInstance,
new SupportedChecker.Implementation(),
storageInstance
storageInstance,
this.configuration.getValidator(),
this.configuration.getClassLoaderProvider()
),
domainClass,
new EclipseStoreTransactionManager(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.serializer.persistence.binary.jdk17.java.util.BinaryHandlerImmutableCollectionsSet12;
import org.eclipse.serializer.persistence.types.Storer;
import org.eclipse.serializer.reference.ObjectSwizzling;
import org.eclipse.serializer.reflect.ClassLoaderProvider;
import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation;
import org.eclipse.store.storage.embedded.types.EmbeddedStorageManager;
import org.eclipse.store.storage.types.StorageManager;
Expand Down Expand Up @@ -69,6 +70,7 @@ public class EclipseStoreStorage
*/
private final Map<Class<?>, VersionManager<?>> versionManagers = new ConcurrentHashMap<>();
private final EclipseStoreStorageFoundationProvider foundationProvider;
private final ClassLoaderProvider classLoaderProvider;
private EntitySetCollector entitySetCollector;
private PersistableChecker persistenceChecker;
private EmbeddedStorageManager storageManager;
Expand All @@ -81,6 +83,7 @@ public class EclipseStoreStorage
public EclipseStoreStorage(final EclipseStoreClientConfiguration storeConfiguration)
{
this.foundationProvider = storeConfiguration;
this.classLoaderProvider = storeConfiguration.getClassLoaderProvider();
}

private StorageManager getInstanceOfStorageManager()
Expand All @@ -94,6 +97,11 @@ public WorkingCopyRegistry getRegistry()
return this.registry;
}

public ClassLoaderProvider getClassLoaderProvider()
{
return this.classLoaderProvider;
}

private synchronized void ensureEntitiesInRoot()
{
if(this.storageManager == null)
Expand Down
Loading