Skip to content

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

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

Convert fields before sending to the page

I have a user dto class and i need to convert some of its properties before send it to frontend. UsedDto class Now, from my controller i get data like this In my case, before send data, i should convert boolean values (enabled, active) to string “Y” or “N”. How can i do this? Answer You can implement a custom

How to implement configuration to use oracle/postgreSQL dataSource with spring+mybatis framework?

Background: spring + mybatis + oracle data source Requirement: support postgreSQL data source exchange with minimum code change Example: Current: controllerA -> ServiceA -> daoA -> A.xml (oracle) Now need: we can configure use oracele/postgreSQL database source If configure use postgreSQL: controllerA -> ServiceA -> daoA -> A.xml (postgreSQL) More: Same controllerA、ServiceA for same business logic Differenct DaoA、A.xml for oracle