I’m trying to register a user entity through an API and add it to “users” table in my local dB. I keep getting the error mentioned below. I am sending a POST request with the following body: It states the “NULL not allowed for column “ID”” but I don’t understand…
Tag: spring-boot
Communicate between microservices on the same machine without exposing a public API
I am relatively new to Camel and Spring, and I am making a service to predict stock prices using a neural network to practise using Camel, Spring and also DL4J. My service is divided into 5 microservices (Gateway, H2 SQL Database, Admin Console, Data Fetcher, DL4J Handler) which will each run in their own Jav…
Admin Process for 12-factor in Java
The 12-Factor blog suggests an App should ‘Run admin/management tasks as one-off processes’. What does that mean in the context of a Java/ Spring-boot application? Can I get an example. https://12factor.net/admin-processes Answer The site does not suggest this. It says that developers may want to …
How do you replace sub entities with HATEOAS links?
I am trying to figure out how to process a series of results in my controller, yet still return links for inline sub resources. when I hit the exposed repository endpoint, I get responses that look like the following: however when I hit my cached version of the entity, I get the following any idea how I can r…
How to handle an error when database returns null value for one of the columns in the table
I’m using Java and Spring Boot with JPQL to access the data. I’m getting the below error because hourlyRate is null in the database: Caused by: org.hibernate.QueryException: could not instantiate class [com.example.model.response.school.Employee] from tuple. I still would like to be able to get th…
Send data object using key
I want to create something like quick switch to send Java object based on Key. I tried this: Full code example: https://github.com/rcbandit111/Code_Switch_Select_POC/blob/main/src/main/java/org/poc/PocController.java Is it possible to use @Service(“first”) instead of @Component(“first”…
Java Spring Boot @Autowired values are null
When I try to print the variable that I have autowired, it prints “null” instead of the value I set it to, “Example.” I can’t quite figure out what I’m missing In my AppConfig class I have: In my other class, DAOMethods, that I want to autowire the variable in: Answer They …
How to search with optional data and list data in ElasticsearchRepository?
I am using spring-data-elasticsearch and I have a class as follows, Above is persisted to elasticsearch. And I have the following method to find data in it. But the challenge I am facing is I have 2 Optional fields and 1 List field that need to check if contains the status. I tried multiple ways in Elasticsea…
Empty response after aplying CORS policy Springboot
When I don’t touch anything about CORS, the browser shows me the common error Access to fetch at ‘http://localhost:8080/denodo-testwebapp/tags’ from origin ‘http://localhost:3000’ has been blocked by CORS policy But meanwhile doing a GET petition on postman I recive the response …
How to synchronize method with HazelCast between two nodes?
There is Spring Boot project. Project works on two nodes. I have method for send message mail with scheduler. The message is sent 2 times, since two nodes are working. How can I use HazelCast to configure the method so that it works once, only by one, more optimal node? There is very little documentation and …