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
Tag: spring
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
How to configure delay time in Spring-retry (Spring Boot)
Is it possible to configure the @Retryable ? This methods (getCurrentRate) will be invoked 3 times. At first is 5 min, after that 10 min, lastly 15 min. How can I configure that ? Example Answer You can achieve that with this configuration: Invocations: After 5m ~ Delay = 300000 After 10m ~ Delay = 300000 * 2 = 600000
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 setup multiple connection pools when multiple datasources are used in Spring Boot?
I have a Spring Boot application that connects to two separate databases. All works fine (I followed the steps in the docs and a tutorial), although in order to customize the Tomcat JDBC connection pool settings, I had to manually configure it (because by defining multiple data sources, the Boot auto-configuration is ignored, and Spring Boot does not read the
All Spring-Boot Application always show a popup login
I’m using Spring and Spring Boot framework with Spring Security for a simple login projects with simple UI. In all my projects, using STS, after starting my application and run the localhost address without errors, i receive a popup login window and not my html page. If i use user and default security password i always get a Whitelabel Error
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