Spring boot sample: Unable to start embedded container error - spring

I am new to spring, so i downloaded jar from spring intializr for maven-web java 1.8 demo. I extracted and imported it to STS to run the main() file and I get below exception. Can some one tell me what's solution for this?
Solutions I tried from web but didn't work:
- Tried adding Hibernate-validator dependency to pom
- Tried adding spring-boot-starter-tomcat dependency to pom
STACK TRACE:
2017-01-26 12:19:32.587 INFO 3816 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2e4b8173: startup date [Thu Jan 26 12:19:32 EST 2017]; root of context hierarchy
2017-01-26 12:19:36.442 WARN 3816 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.http.encoding-org.springframework.boot.autoconfigure.web.HttpEncodingProperties': Initialization of bean failed; nested exception is javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
2017-01-26 12:19:36.454 ERROR 3816 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
The Bean Validation API is on the classpath but no implementation could be found
Action:
Add an implementation, such as Hibernate Validator, to the classpath
Pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Application file:
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}

Had the same problem with release version 1.5.9 of Spring Boot.
To add to the answer by Jim Kiley, you should add the following in Maven pom.xml:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.3.6.Final</version>
</dependency>
You can use the dependency version under properties section of Spring Boot pom.xml file (spring-boot-dependencies-1.5.9.RELEASE.pom):
<hibernate-validator.version>5.3.6.Final</hibernate-validator.version>
Located under path:
/.m2/repository/org/springframework/boot/spring-boot-dependencies/1.5.9.RELEASE/spring-boot-dependencies-1.5.9.RELEASE.pom

As the output says, you need to:
Add an implementation, such as Hibernate Validator, to the classpath
Since you're using Maven, that means you need to add the Hibernate Validator to your pom.xml's dependencies.

First of all, your pom.xml settings are correct.
spring-boot-starter-web has the dependency to hibernate-validator.
So in your project, you don't need to specify the dependency to hibernate-validator. Otherwise, what's the purpose to use maven?
So back to the resolution, the steps I did to resolve the problem are:
Goto project folder where the pom.xml is located.
Run mvn verify
The command will download the missing jar again from the repository and also check the correctness(corrupted or not) of jars in maven local repository.
If you see the warning messages similar to following:
[WARNING] error reading /home/vagrant/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.6/tomcat-embed-core-8.5.6.jar; invalid LOC header (bad signature)
[WARNING] error reading /home/vagrant/.m2/repository/org/hibernate/hibernate-validator/5.2.4.Final/hibernate-validator-5.2.4.Final.jar; invalid LOC header (bad signature)
[WARNING] error reading /home/vagrant/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.8.4/jackson-core-2.8.4.jar; invalid LOC header (bad signature)
Then this means that the jars downloaded by maven previously has been corrupted.
To correct this, please delete those corrupted jars and run mvn verify again to re-download them and also ensure that there's no warning for jars.
Go back to your IDE(STS or Eclipse), update your project and run the application again.
In above error the hibernate-validator-5.2.4.Final.jar is the hibernate validator that in quesion.

I met same issue and resolved it by delete these two folders under .m2
com\fasterxml --> delete it will resolve TypeResovler issue.
org\springframework --> delete it will resolve lack of validator
issue.
then the program works.

I faced the same issue while runs the application and resolved the issue by deleting the .m2 folder.
.m2/repository

Related

Starting Quarkus in Dev Mode results in NoSuchMethodError: org.jboss.threads.JBossExecutors.rejectingExecutor()Ljava/util/concurrent/Executor

I am currently migrating a java web application to quarkus. After having migrated all code parts and done most adaptions, I wanted to try it out by running the app in dev mode:
./mvnw compile quarkus:dev
But it crashes right at the beginning with a NoSuchMethodError for java/util/concurrent/Executor:
2022-04-01 18:07:06,022 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure
2022-04-01 18:07:07,444 INFO [org.jbo.threads] (main) JBoss Threads version 2.3.3.Final
2022-04-01 18:07:07,451 ERROR [io.qua.dep.dev.DevModeMain] (main) Quarkus dev mode failed to start: java.lang.NoSuchMethodError: org.jboss.threads.JBossExecutors.rejectingExecutor()Ljava/util/concurrent/Executor;
at io.quarkus.vertx.core.runtime.QuarkusExecutorFactory.internalCreateExecutor(QuarkusExecutorFactory.java:48)
at io.quarkus.vertx.core.runtime.QuarkusExecutorFactory.createExecutor(QuarkusExecutorFactory.java:42)
at io.vertx.core.impl.VertxImpl.(VertxImpl.java:161)
at io.vertx.core.impl.VertxBuilder.vertx(VertxBuilder.java:225)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder.initialize(VertxCoreRecorder.java:236)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$VertxSupplier.get(VertxCoreRecorder.java:577)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$VertxSupplier.get(VertxCoreRecorder.java:559)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder.startServerAfterFailedStart(VertxHttpRecorder.java:208)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup.handleFailedInitialStart(VertxHttpHotReplacementSetup.java:61)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.startupFailed(RuntimeUpdatesProcessor.java:1145)
at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:168)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:455)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:66)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:140)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:96)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:132)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Exception in thread "main" java.lang.RuntimeException: java.lang.NoSuchMethodError: org.jboss.threads.JBossExecutors.rejectingExecutor()Ljava/util/concurrent/Executor;
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:138)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: java.lang.NoSuchMethodError: org.jboss.threads.JBossExecutors.rejectingExecutor()Ljava/util/concurrent/Executor;
at io.quarkus.vertx.core.runtime.QuarkusExecutorFactory.internalCreateExecutor(QuarkusExecutorFactory.java:48)
at io.quarkus.vertx.core.runtime.QuarkusExecutorFactory.createExecutor(QuarkusExecutorFactory.java:42)
at io.vertx.core.impl.VertxImpl.(VertxImpl.java:161)
at io.vertx.core.impl.VertxBuilder.vertx(VertxBuilder.java:225)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder.initialize(VertxCoreRecorder.java:236)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$VertxSupplier.get(VertxCoreRecorder.java:577)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$VertxSupplier.get(VertxCoreRecorder.java:559)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder.startServerAfterFailedStart(VertxHttpRecorder.java:208)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup.handleFailedInitialStart(VertxHttpHotReplacementSetup.java:61)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.startupFailed(RuntimeUpdatesProcessor.java:1145)
at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:168)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:455)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:66)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:140)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:96)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:132)
... 1 more
The app uses a ScheduledExecutorService, that is being created like this:
#ApplicationScoped
public class ExecutorInit {
#Produces
#ApplicationScoped
public ScheduledExecutorService getScheduledExecutorService(
#ConfigProperty(name = "systemRuntime.threadPoolSize") Integer threadPoolSize) {
return Executors.newScheduledThreadPool(threadPoolSize);
}
}
I suspect this to be involved in the error, but I am currently lacking the understanding why this is happening or what I could possibly do about it.
(if you want to try it out yourself, checkout: https://github.com/labsai/EDDI/tree/version-5)
Maven pom.xml config version:
<properties>
<dependency.version.lombok>1.18.22</dependency.version.lombok>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<jandex-maven-plugin.version>1.2.2</jandex-maven-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus-plugin.version>2.7.5.Final</quarkus-plugin.version>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>2.7.5.Final</quarkus.platform.version>
<quarkus.jgit.version>1.2.0</quarkus.jgit.version>
<quarkus.microprofile.version>2.4.1.Final</quarkus.microprofile.version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
<failsafe-plugin.version>3.0.0-M5</failsafe-plugin.version>
<war-plugin.version>3.3.2</war-plugin.version>
</properties>
(https://github.com/labsai/EDDI/blob/version-5/pom.xml)
I still don't know the root cause of the issue described above, but here is what i did to overcome it:
added this dependency to my pom.xml
<dependency>
<groupId>org.jboss.threads</groupId>
<artifactId>jboss-threads</artifactId>
<version>3.4.2.Final</version>
<scope>provided</scope>
</dependency>
While i had other errors in my migration code, they were not being displayed anywhere until I overcame the described problem by providing this dependency.
After having fixed several other likely unrelated issues, i didn't seem to need this dependency anymore.
While this step is not a real solution, it helped my to proceed further and unveil other issues that were not being displayed at first.

Are spring-boot-starter-data-jpa and Liquibase incompatible?

I tried to setup a new Spring Boot 2.4.3 project and I want to include Liquibase as well as Spring Data JPA.
To achieve this I use the following dependencies in my POM:
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>${liquibase.version}</version>
</dependency>
or...
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate5</artifactId>
<version>${liquibase.version}</version>
</dependency>
...respectively and
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
with
<kotlin.version>1.4.31</kotlin.version>
<liquibase.version>4.3.1</liquibase.version>
<hibernate.version>5.4.29.Final</hibernate.version>
Yet, in the beginning, I don't have any DB setup so far and in application.yaml you can find:
server:
port: 8080
spring:
liquibase:
change-log: classpath:db/changelog/db.changelog.yml
wherbey db.changelog.yml is empty.
A Maven install using the spring-boot-starter-data-jpa dependency results in:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is
liquibase.exception.ChangeLogParseException: Empty file classpath:db/changelog/db.changelog.yml
Caused by: liquibase.exception.ChangeLogParseException: Empty file classpath:db/changelog/db.changelog.yml
while when commenting out this dependency the build succeeds.
I found out that the empty db.changelog.yml file must contain at least:
databaseChangeLog:
- changeset:
although on https://docs.liquibase.com/concepts/basic/changelog.html an example is given that an empty changelog.yaml file needs to look like:
databaseChangeLog:
, but this results in a BeanCreationException:
Caused by: liquibase.exception.ChangeLogParseException: Could not find databaseChangeLog node

Springboot client server architecture

Created Eureka discovery client and server architecture. In client there is userInfo service CRUD opeartion. Its showing error while starting . Error is Error creating bean with name 'configurationPropertiesBeans' defined in class path resource [org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader#2626b418].
This looks like an issue with the Spring boot version and Spring Cloud version. As per the reference Deprecated ConfigurationBeanFactoryMetadata is removed in Spring Boot 2.3.0.M1, the reported class is deprecated.
Please choose the correct version of Spring Boot and Spring Cloud to continue, refer to Release train Spring Boot compatibility
Pasting my pom.xml version for reference, hope it helps:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.2</version>
<relativePath />
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>15</java.version>
<spring-cloud.version>2020.0.1</spring-cloud.version>
</properties>

Do Spring LDAP and Spring Cloud Consul work together?

I had a project with Spring LDAP in place. I am trying to put in Spring Consul into this project and have been facing issues with respect to it.
Here is the pom.xml :
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-all</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
Here is application properties :
#consul properties
spring.cloud.consul.config.format=PROPERTIES
spring.cloud.consul.discovery.healthCheckPath=/<root>/health
spring.cloud.consul.discovery.healthCheckInterval=15s
spring.application.name=<App_Name>
spring.profiles.active=dev
And I enabled discovery client using #EnableDiscoveryClient on SpringBootApplication class.
But, I am ending up with this error and the app never starts :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field ldapTemplate in com.<package>.config.LdapClient required a bean of type 'org.springframework.ldap.core.LdapTemplate' that could not be found.
- Bean method 'ldapTemplate' not loaded because #ConditionalOnClass did not find required class 'org.springframework.data.ldap.repository.LdapRepository'
Action:
Consider revisiting the conditions above or defining a bean of type 'org.springframework.ldap.core.LdapTemplate' in your configuration.
Disconnected from the target VM, address: '127.0.0.1:62703', transport: 'socket'
I figure it has something to do with autodiscovery of Ldap and introducing Consul is causing this issue, but, I am not able to pin-point the problem.
Can someone please help me resolve this issue?

Testing Neo4j with Spring Boot and embedded driver

Problem
I build an application using a Neo4j database. I like to test some custom Cypher queries using Spring Boot's #DataNeo4jTest annotation (see also Spring Boot Test - Neo4j), but I run in either one of the following problems:
The test tries to connect to a Neo4j instance using the BOLT driver.
The test fails to load the embedded driver.
Details
My dependencies are managed with Maven following the Spring Data Neo4j Reference Documentation. Section 10.3.1 of the SDN documentation explains:
By default, SDN will use the BOLT driver to connect to Neo4j and you don’t need to declare it as a separate dependency in your pom. If you want to use the embedded or HTTP drivers in your production application, you must add the following dependencies as well. (This dependency on the embedded driver is not required if you only want to use the embedded driver for testing. See the section on Testing below for more information).
Therefore, the relevant parts of my pom.xml are:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi=...>
...
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
...
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-neo4j</artifactId>
</dependency>
<dependency>
<groupId>org.neo4j.test</groupId>
<artifactId>neo4j-harness</artifactId>
<version>3.3.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
...
</project>
My main/resources/application.yml is:
spring:
data:
neo4j:
uri: bolt://localhost
username: <username>
password: <password>
My test/resources/application.yml is:
spring.data.neo4j.uri: file:///neo4j.db
Without the test/resources/application.yml I get the following exception, which I assume is caused by using the BOLT driver:
org.springframework.transaction.CannotCreateTransactionException: Could not open Neo4j Session for transaction;
nested exception is org.neo4j.driver.v1.exceptions.AuthenticationException: The client is unauthorized due to authentication failure.
With the test/resources/application.yml I get the following exception:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'neo4jAuditionBeanFactoryPostProcessor': Unsatisfied dependency expressed through constructor parameter 0;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.neo4j.ogm.session.SessionFactory]: Factory method 'sessionFactory' threw exception;
nested exception is org.neo4j.ogm.exception.core.ConfigurationException: Could not load driver class org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver
Questions
Are there any dependencies missing?
Is the configuration wrong?
Does anyone have a link to a working example using the Spring Boot annotation #DataNeo4jTest?
Any suggestion is welcome.
I have found a solution to my problem. It seems as if the BOLT driver is used as default for testing as well - which is confusing given the Spring Data Neo4j (SDN) documentation. Finally, the pom.xml of the GitHub project movies-java-spring-data-neo4j helped me. I added the following test dependency to my pom.xml:
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-embedded-driver</artifactId>
<version>${neo4j-ogm.version}</version>
<scope>test</scope>
</dependency>
I kept the test/resources/application.yml but removed the line:
spring.data.neo4j.uri: file:///neo4j.db
Now, the test context starts with the embedded driver, and creates a temporary database file like file:/C:/Users/Me/AppData/Local/Temp/neo4j.db6943517458205762238/, which is awesome. I can get a clean database instance for every test method.
I hope this answer will help others, who have the same problem. I'm happy to provide more details if necessary.
#DataNeo4JTest works great with Spring Boot 2.x.
Example Test:
#RunWith(SpringRunner.class)
#DataNeo4jTest
public class WidgetRepositoryTest {
#Autowired
private WidgetRepository repository;
private Widget widget;
#Before
public void setUp() {
widget = WidgetTestData.builder().build();
}
#Test
public void itShouldSaveAndRetrieve() {
final Widget saved = repository.save(widget);
assertThat(saved.getId()).isNotNull();
assertThat(saved.getName()).isEqualTo(widget.getName());
final Optional<Widget> found = repository.findById(saved.getId());
assertThat(found).hasValueSatisfying(w-> {
assertThat(w.getId()).isEqualTo(saved.getId());
assertThat(w.getName()).isEqualTo(saved.getName());
});
}
}
The Neo4J-related dependencies in my Maven POM:
<dependency>
<groupId>org.neo4j.test</groupId>
<artifactId>neo4j-harness</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-embedded-driver</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-neo4j</artifactId>
</dependency>

Resources