Skip to content
Advertisement

Tag: spring

Why do I have to set AuthenticationManager twice

In my application I’ve implemented X.509 authentication I created the following class named X509AuthenticationFilter that extends AbstractPreAuthenticatedProcessingFilter provided by spring security by default. I added my own AuthenticationManager to the class And also included the following setter The bean is initialized in the spring-security.xml like so: The bean named authenticationManager does exist and it’s present in the spring context. However,

Nested entities contains null after save

I have an entity with some nested entities like this with entity2 and entity3 like this: Both Entity2 and Entity3 have values stored in the database so when I’m doing an insert on MyEntity, I’m doing this: it works fine, the data are stored correctly in the DB with the correct foreign keys BUT… After insert I want to build

BeanCreationException when creating Bean of type org.springframework.web.servlet.LocaleResolver

I’m trying to apply internationalization in a Spring Boot app by following some guide. For some reason, in the guide that I’m following it works but not on my local. I can’t figure out why. The error I am getting in console is : org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘localeResolver’ I am aware that when Spring creates a Bean,

Convert Java object to json string containing a json string property already

Consider a Java object like following: so when we do, I was expecting something like: instead I got it as a json value wrapped into a double quotes and skipped by backslashes as it was double jsonized – if this is actually a verb – Answer I managed to overcome this problem by using @JsonRawValue From documentation https://fasterxml.github.io/jackson-annotations/javadoc/2.5/com/fasterxml/jackson/annotation/JsonRawValue.html it states

Convert nested map fields to snake case

how to convert all the nested fields of the following object rendered as json to snake_case? Given it’s read as a org.bson.Document, jackson object mapper won’t work as it’s designed for POJOs and it’s not possible to have POJOs here as the records are schema-less Answer It can be easily done by adding a custom key serializer to SimpleModule, then

Endpoint overloading in Rest controller

I have a REST Controller in my Spring Boot application as follows: Upon trying to start the application, I get the following error: Upon changing the endpoints(in the getmapping part), this works perfectly. I fail to understand that since it does not recognise one with query param and one without as 2 separate points, then what is the possible fix

An “Error creating bean with name ‘functionBindingRegistrar'” exception every time I start my application

I have a normal spring cloud stream application that simple reads data from Kafka topic and produces messages to another Kafka topic, please find below the configurations: And the following application.proeprties And below is the signature of all defined spring cloud functions Everything works fine, and the application starts and functions as it should, however, in the logs I encounter

Advertisement