Skip to content
Advertisement

Tag: spring

Spring Data Mongodb Query by embedded document id

i am trying to query a model that contains a @Reference as attribute like: and so on, then i have a query with more logic and code but in resume i have to filter by the field _id from Branch object, its just id on the object but on database its _id, ok no problem its normal behavior for the

Is there a way to shorten boolean RequestParams in Spring Boot?

Thanks for all trying to help 🙂 Backround information: I use the spring framework version 2.4.3 together with Java (and Maven) To my question: Is it possible to shorten http://localhost:8080/api/v1/example?admin=true&superPrivilege=true to something like http://localhost:8080/api/v1/example?admin&superPrivilege. So what I want is to use boolean Parameters as Flag. If the parameter is set then it counts as true if not as False. Is

Clean shutdown of Spring WebSockets STOMP client

A Spring WebSocket STOMP client sends a long to Spring WebSocket STOMP server that immediately returns the same value. When the client completes sending, it exits its main thread and the client terminates as expected. If I enable STOMP heartbeats: the client no longer exits the JVM when the client’s main thread finishes because the DefaultManagedTaskScheduler task-scheduler started a non-daemon

Java show/hide object fields depending on REST call

Is it possible to config the Item class that depending on the REST call to show and hide specific fields? For example I want to hide colorId (and show categoryId) from User class when calling XmlController and vice versa when calling JsonController. Item class JSON Controller XML Controller Answer I’ve solved it by creating following View: With this config it

After trying to test connection to h2 database or connect whitelabel error occurs

After running Spring boot project and going to localhost:8080/h2-console and after trying to connect to my database I get whitelabel error when i click any button on h2-console screen. I am using in memory database. I am trying to connect to database with classic username:sa and password:(blank) Even after clicking Save i get whitelabel error application properties: pom xml: configure

Print body in handler from post request in spring webflux

I am completely new to Reactive Spring Webflux. I am writing a handler for a Post request which should Accept Json body(Employee id, name and role), Fetch some more Employee details from database 1 using id field, Return Employee json back with additional attributes like age and dept.. My router code is below: Post Body: Model Class looks like this

Prevent Spring from prefixing booleans with is only in certain cases

I have an object with a boolean property called hasEnoughBalance, but Spring (or Lombok, or whoever it is) appears to be renaming the getter to isHasEnoughBalance instead of getHasEnoughBalance or plain hasEnoughBalance. How could I prevent that? I know of @JsonProperty, but I’d like another solution if possible. Answer This is being done by Lombok. One way is to use

Advertisement