Skip to content
Advertisement

Tag: spring

How to add Quartz JobListener

I am writing a java/spring library to include in other projects that are using quartz. I need it to log something before each task is executed. I have a simple JobListener that looks like this: I know we can do something like this to add joblisteners: But how can I get the scheduler to add so I can add the

Is it possible to disable LoggingFailureAnalysisReporter during spring boot failure?

Is it possible to disable LoggingFailureAnalysisReporter execution during spring boot failure? I made a custom FailureAnalysisReporter and I don’t want to report twice. Answer I just found a way to archive what i want, simply adding: <logger name=”org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter” level=”OFF” /> to my logback configuration will disable any logging from this class, which is essencialy the only thing LoggingFailureAnalysisReporter do.

map yaml config to a java hashmap

I have below in my yaml I am map it in my spring bean as follow, I get below error, Cannot convert value of type [java.lang.String] to required type [java.util.Map]: no matching editors or conversion strategy found How can I map a configuration map representation to a java hashmap? Answer In yaml try to format it in this way: Or

@ResponseBody returns empty object

When I use below to get the user object it works just fine. Above gives me a response back as: Now, I am trying to search based on UUID(4) using this: This doesn’t return anything. No error, no warning whatsoever. While this gives me all the details I need: This is what I have in my Repository and Entity Question:

Connecting to mongoDB in spring boot causes errors

I want to connect to mongoDB Atlas in a spring boot project, but always Exceptions are thrown. If I use Java without spring boot, everything works fine. The following test project reproduces the errors. The pom.xml: The Main-class: And the configuration for mongoDB: The uri for mongoDB is stored in application.properties. If I start the server, the following exeception is

Advertisement