Skip to content
Advertisement

Tag: spring-mvc

Exclude fields from Java object using Spring

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 do it? Answer I

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 loginProcessingUrl should be allowing Spring to handle the authentication in the background without needing me to provide a URL. Below are

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 what I understood

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 fine. However, if user changes project on UI ( through select onchange=”‘location

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. Then he asked why we need to

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 passed in request body of API, the code should set a default value (being

Advertisement