logo
down
shadow

Very slow start up for Spring Boot tests with Embed Mongo DB


Very slow start up for Spring Boot tests with Embed Mongo DB

By : Marou Baklouti
Date : November 22 2020, 04:01 AM
this one helps. Spring Boot has out-of-the-box support for embedded MongoDB. Also the embedmongo-spring seems dated as it hasn't been touched in 3 years.
Use the out-of-the-box support for embedded MongoDB instead of trying to wrap something else around it.
code :
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
    <groupId>de.flapdoodle.embed</groupId>
    <artifactId>de.flapdoodle.embed.mongo</artifactId>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>


Share : facebook icon twitter icon
Spring Boot: Exception Handling if mongo diconnects after application start up

Spring Boot: Exception Handling if mongo diconnects after application start up


By : David
Date : March 29 2020, 07:55 AM
Does that help SessionRepositoryFilter http://docs.spring.io/spring-session/docs/current/api/org/… added by your @EnableMongoHttpSession is the code that fails here. It executes before any controller-related machinery (including advices) may come into play, so if it fails, it does so before any controller scope is created.
But you can create a filter, insert it into filter chain before Mongo Http Session filter and try to catch and handle that exception:
code :
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) {
    try {
        chain.doFilter(request, response);
    } catch (TranslatedException e) {
        // somehow handle it, like display an error message
    }
}
Spring Boot trying to create mongo repositories in tests using @JsonTest annotations

Spring Boot trying to create mongo repositories in tests using @JsonTest annotations


By : Nathan O'Halloran
Date : March 29 2020, 07:55 AM
it should still fix some issue You could just create a test without spring runner.
This is an example example test
Spring Boot Cache + Apache ignite + Spring Boot Actuator - Application fail to start when running tests

Spring Boot Cache + Apache ignite + Spring Boot Actuator - Application fail to start when running tests


By : mallikarjun
Date : March 29 2020, 07:55 AM
wish of those help I have a project where i use Spring Boot 2.0.0+ , Spring Boot Cache, Apache Ignite, Spring Boot Actuator and TestNG. , It's hard to say who is exactly to blame here, but as you can see:
code :
Caused by: java.lang.AssertionError: null
    at org.apache.ignite.cache.spring.SpringCacheManager.getCacheNames(SpringCacheManager.java:371) ~[ignite-spring-2.7.0.jar:2.7.0]
    at org.springframework.boot.actuate.autoconfigure.metrics.cache.CacheMetricsRegistrarConfiguration.bindCacheManagerToRegistry(CacheMetricsRegistrarConfiguration.java:73) ~[spring-boot-actuator-autoconfigure-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[na:1.8.0_144]
    at org.springframework.boot.actuate.autoconfigure.metrics.cache.CacheMetricsRegistrarConfiguration.bindCachesToRegistry(CacheMetricsRegistrarConfiguration.java:69) ~[spring-boot-actuator-autoconfigure-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    ... 73 common frames omitted
Spring-boot slow to start

Spring-boot slow to start


By : Andrey80
Date : March 29 2020, 07:55 AM
around this issue I've been suffering slow startup times myself and wondering what the cause was. I get all the console messages saying various things have started and then it hangs just before the final message to say the app has loaded.
Eventually I found I could use Java VisualVM as part of the JDK to see what was going on. If you have the jdk installed its jvisualvm.exe in the bin folder. Then when I select to debug as Application.java the tomcat process pops up and you can track what's going on.
Cannot start an OSGI bundle that embed spring boot in liferay 7

Cannot start an OSGI bundle that embed spring boot in liferay 7


By : l.laz
Date : March 29 2020, 07:55 AM
To fix the issue you can do I want to develop a standalone bundle that implement a service using spring boot and spring data jpa (without web). The bundle aims to create a spring context to facilitate the creation of Repository, and in teh bundle activator, I create the spring boot application, get an implementation of service that use the injected repository and this service will be registered as an OSGI service. , I saw 2 questions in your post so I'll try to answer those:
Related Posts Related Posts :
  • How to save key value pair in mongoose correctly
  • How filter $lookup result
  • I am not able to execute aggregate operation on mongoDB using Groovy
  • Update field in mongoDB with it's substring
  • How to use Spark MongoDB-Connector with conditional query ?
  • How to write query with LIKE in MongoDB?
  • Get index of array when filter in mongodb
  • Get first embedded document in an array
  • Same shards across different MongoDB collections
  • what is alternative for AggregationOutput to perform lookup operation in mongoDB
  • How to define nested array in Mongoose Schema
  • MongoDB in Go in relation to JSON and BSON
  • MongoDB aggregation - choose a lookup collection depending on the data. Can it be done?
  • How do I disable GridFS MD5 calculation in Spring Boot?
  • $group to get all related data in array
  • Mongoose: $sum in $project return only zero
  • Mongo Shell - Console/Debug Log
  • Relations in Document-oriented database?
  • How do I perform the SQL Join equivalent in MongoDB?
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org