I have two endpoint who use the same model class (Cars). For the searchBigList endpoint I would like to retrieve all car fields and for searchCarSmallList endpoint I would like to retrieve just 3 fields. I tried to do it with @JsonView annotation but it was not working for me. Anyone have better idea how to d…
Tag: spring-mvc
ERROR: org.apache.logging.log4j.Logger.atDebug()Lorg/apache/logging/log4j/LogBuilder
When I try import a file from front to my api, throws this error: org.apache.logging.log4j.Logger.atDebug()Lorg/apache/logging/log4j/LogBuilder I just have this log4j dependency in my pom.xml: This is my Controller: Thank you in advance. Answer I saw a post that solved my problem, just put this dependency:
Spring giving 404 on loginProcessingUrl when authenticating login
I’ve configured my Spring app to authenticate logins using the /authenticate url, but each time I try signing in it throws the following error: org.springframework.web.servlet.DispatcherServlet.noHandlerFound No mapping for POST /authenticate I’m confused because as far as I’m aware, the log…
How to insert all enums into database?
We have a list of ENUMS for different purposes. Sample Enum: we use .sql file to save this enums, Problem: We need to write values two times (One in enum and another one .sql statement) It seems not efficient way, Is any other way to save ENUMS to avoid this repetition? Answer From the above mentioned details…
SpringBoot app does not run with exceptions
I am new at Spring Boot so I’m trying to create a simple Crud but I keep getting this error when I run my application I spose it must be some version problem but I don’t know how to fix it. I created the project with STS on ubuntu using mostly default options Answer It looks like you have java
Spring session attribute lost on page calling itself
So, I’ve got a very simple 2 controller Spring MVC app. First controller logs user in and puts it on session like this model.addAttribute( “user”, userDto ); Second controller displays project based on projectId, but expects user to be in session. First call to this controller works just fin…
Handle an exception in another method without losing the request objects from original one
There is an Exception that is thrown when an user is not found in database and i’d like to handle that particular exception from the controller perspective layer in a separated method by @ExceptionHandler annotation without losing the original data sent by the user. Well, so, i’m using Sessions an…
Garbage collector vs IOC
Today I attend the interview I am a newbie to java, spring boot. The interviewer asked the question about garbage collectors. I said the garbage collector will release the unused resource. Then he asked about the IOC container, I said it take control of object creation and will inject into the dependent bean.…
What is the difference between PropertyEditor, Formatter and Converter in Spring?
Working with Spring MVC it turns out that I can bind my forms in many different ways and I really feel like I’m getting lost. The parse and print methods of a Formatter are equivalent to those of a PropertyEditorSupport with a different name (getAsText and setAsText). Similarly, I can implement either a…
value not injecting in @ReuqestBody POJO from application-dev.properties – SpringBoot Application
I am new to Java SpringBoot and I am trying to inject a default value from application-dev.properties file. Basically, the idea is to set default value to RequestObject’s id property, default value being injected(/fetched) from application-dev.properties. UseCase: In case, no data or blank data is being…