Skip to content
Advertisement

Tag: spring

Custom Http Status Code in Spring

I am using Spring Boot and I am using Exception Classes thoughout my business logic code. One might look like this: Well now there are Exception, where no predefined Http Status code is fitting, so I would like to use a status code like 460 or similar, which is still free, but the annotation ResponseStatus just accepts values from the

Custom Jackson Deserialization of a Generic Abstract class

I am having issues when trying to deserializing the following class: My generic abstract class: I have two concrete classes which implement MetricValueDto: IntMetricValueDto: FloatMetricValueDto: Any idea of what’s the correct strategy to deserialize MetricValueDto so I can parse it through ObjectMapper or an RestTemplate? Whenever I run: I get Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.resson.dto.MetricValueDto: abstract

How does Conditional annotation works in Spring Boot?

I understand that Spring Boot has lots of @Conditional annotations like, @ConditionalOnBean, @ConditionalOnClass, @ConditionalOnProperty, ConditionalOnWebApplication. But I do not know how this work? For Example: What I understood is, MyConfiguration will be loaded only if MyBean is available in my classpath. But how would it compile and run if MyBean class is not in my class path as the compiler

Spring Websocket STOMP: send RECEIPT frames

I have a Websocket-stomp server based on Spring and its SimpleBroker implementation (not utilizing an external broker). I would like to enable STOMP RECEIPT messages. How I could configure my code to send these automatically? Answer In Spring Integration test for the STOMP protocol we have this code: https://github.com/spring-projects/spring-integration/blob/master/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/inbound/StompInboundChannelAdapterWebSocketIntegrationTests.java

Error creating a login using LDAP

I’m trying to create a page with spring to authenticate using ldap. I followed the official guide but trying to connect to my active directory instead of a test code. AppApplication.java HomeController.java WebSecurityConfig StackTrace I think the error is in the LDAP connection, but I think I have all the parameters fine. If you need more information please, tell me.

How to get user id with Spring MVC?

I using the POST method for add Item to the database with Spring MVC. But each Item has field userId, it FOREIGN KEY to users table. Need to know user’s id for this. I using Spring security for auth. May be there is a possibility get current user’s id with ServletContext or HttpSession, may be spring security save user’s id

Query DSL Q type classes not generated

I am trying to use QueryDSL in my eclipse maven project. These are the dependencies. After this I try to write the queries. But I get the error Note: ReportingParamDAO is an entity class. This means that the Q type class for my DAO is not generated. I am not sure why it wasn’t generated. Do I need to do

Advertisement