Skip to content
Advertisement

Tag: spring-boot

Spring batch job runs automatically

I’m using a spring batch to read a CSV file and write it to the DB, using the controller trigger. On starting the application, before I hit from the browser url, I see the print statements from my reader, on the startup. Although it doesn’t print it for my processor or writer, which are in separate classes which I have

Dynamically update the @value annotated fields in spring

I am trying to dynamically update the @value annotated fields in my application. First of all, this application has a custom property source, with source being a Map<Object, String>. A timer is enabled to update the values after a minute interval. Initial values of source Map<String, Object> is supplied from the PropertySourceLocator. (This is not the real scenario, but I

How to use ElasticSearch JSON DSL in Java?

I’m working on a springboot project and having some trouble with ElasticSearch. The user will put some JSON-format elasticsearch DSL query strings in the database and they are black-box to me. What I need to do is get the query strings and use them so search information in elasticsearch. In python, the DSL can be a parameter like this: How

Spring JPA-I get error that object is not persisted even though i have persisted it

I am using Spring boot-I have 3 classes User,Role and UserRole.I have pesisted both role object and user object but i get error that role object is not persisted.The mappings- between User and UserRole is OneToMany ,between Role and UserRole OneToMany.In the UserServiceImpl class i have persisted Role object roleRepository.save(userRole.getRole()); Error is- Answer Couple of issues here. The first (and

Make Redis as optional

I am using spring boot with Redis.Redis is running as Docker container Redis is a memory DB, if it finds data in Redis based on the key, it retrieved from Redis otherwise go into actual db call. when Redis is running, code works fine. but sometimes for any reason, if Redis is down, I am getting exception RedisConnectionException: Unable to

Upload a file using Java 11 HttpClient to SpringBoot Server

My client upload method: My Spring Boot method that receives the file: The current error: What kind of headers can I add to ensure my Spring Boot server receives the file without errors? Answer MultipartException: Current request is not a multipart request This is telling you what’s wrong. In your code: .PUT(HttpRequest.BodyPublishers.ofFile(photo.toPath())), you are doing a PUT request with file’s

Spring boot error in Application.java package

hello I just created a project in spring boot initializer but when I import the project in sts I have a set of errors that I do not understand the errors are : The type java.lang.Class cannot be resolved. It is indirectly referenced from required .class files Implicit super constructor Object() is undefined for default constructor. Must define an explicit

Advertisement