Questions tagged [spring-boot]

Get the most out of your web application by leveraging Spring Boot framework. Use the Spring Boot tag to ask questions about its various features such as configuration, web server embedding, metrics setup, health checks, and externalized configuration. Remember, this tag is not meant for queries regarding the web server itself, Java code execution, or standard spring components. To enhance your chances of getting the best response, make sure you also add relevant tags specific to your question.

Utilizing Axios for Submitting Form Data: A Step-by-Step Guide

Currently, I am in the process of developing a project that consists of a springboot backend and Vue frontend. At this point, I have successfully managed to retrieve a list of products from my database using GET requests. While I can display this list on a ...

I keep encountering a "map is not a function" error while working with React JS

I am attempting to retrieve and display data from a MySQL database using Spring Boot and React JS in a table format. However, I am encountering an error while trying to display the information. componentDidMount(){ const currentUser = AuthService.g ...

"What are the necessary components to include in UserDTO and what is the reasoning behind their

Presenting the User entity: package com.yogesh.juvenilebackend.Model; import jakarta.annotation.Generated; import jakarta.persistence.*; import lombok.*; @Entity @Getter @Setter @NoArgsConstructor @AllArgsConstructor @RequiredArgsConstructor public class ...

Spring Boot: The Ultimate Solution for JSON Data Retrieval

As I work on constructing a REST API, I've come across multiple methods for returning JSON data. However, I am seeking the most effective approach that is scalable over time and can manage many-to-many relationships, along with deep relations such as Artic ...

Encountering issues executing a POST operation in React using the fetch method

I am currently trying to send a POST request using ReactJS and update data in a Mongo database with Spring Boot. Although I didn't encounter any errors during code compilation, I'm facing an issue where there is no output when attempting the POST ...

Is it possible to create a mapping for the jsonProperty of nested fields in an object?

In my project, I have created two classes named Car.java and Bus.java. Car.java private Property property; Bus.java private Property property; The Property.java class contains attributes for number and colour. ...

The browser is failing to send cookies to the backend and is also not properly setting them initially

Greetings everyone, I am currently in the process of securing my spring boot application with HTTP only cookies, transitioning from local storage. However, I have encountered some challenges along the way that even chatGPT couldn't resolve :) Let&apo ...

A guide on exporting an Excel file with Spring Boot and Angular 2

To fulfill the requirements of my project, I am tasked with exporting customer data into an Excel file. Utilizing a table structure using Hibernate build. Here is my controller code: @RequestMapping(value="exporttoexcel", method= RequestMethod.GET, prod ...

Reading JSON in Spring Boot can sometimes be challenging, especially when faced with errors like "Cannot deserialize value of type `X` from Array value." This error typically occurs when trying to parse an array value

I am facing an issue with sending data from my Angular application to SpringBoot. The problem arises when the server does not receive the correct object that is being sent. Upon checking the console.log output for what is being sent to the server, everyth ...

How can JHipster components be effectively shared with other projects for optimal usage?

Exploring JHipster, the Spring Boot + AngularJS application generator based on Yeoman has been an interesting and fun experience. Setting up a vanilla webapp was relatively easy. Now, the goal is to separate entities, repositories, and services from the o ...

A guide on transitioning your project from bower to npm

Currently, I am involved in a jhipster project that utilizes both bower and npm. We have decided to phase out the use of bower and transition to npm packages. Is there a way for me to migrate from bower to npm using npm exclusively, without resorting to ...

ReactJS application encountering CORS error while accessing endpoint in Spring Boot Application secured with Keycloak

I am currently working on integrating ReactJS and Java Spring Boot applications, both protected by Keycloak 11.0.2. Keycloak is running on port 8083, ReactJS on port 3000, and the Spring Boot application on port 8085. However, when I attempt to utilize th ...

Issue with Jackson serialization in @ManyToMany association

I am currently facing the following scenario: //--class user -- private .... @OneToMany(targetEntity = UserRoles.class, mappedBy = "iduser", fetch = FetchType.LAZY) @JsonManagedReference private List<UserRoles> userRoleList = new ArrayList<>( ...

The issue with Spring's JSON serialization causing errors when converting to a Java Map

In my ReactJs client, I have a form with multiple radio inputs and one textarea input that I submit using axios. The code for the request is as follows: axios.post("/wellbeing/" + params.wellbeingSurveyType, { formAnswersJson: formAnswers }) ...

Navigate to the editing page with Thymeleaf in the spring framework, where the model attribute is passed

My goal is to redirect the request to the edit page if the server response status is failed. The updated code below provides more clarity with changed variable names and IDs for security reasons. Controller: @Controller @RequestMapping("abc") public clas ...

Angular2/4 preflight request encountered an invalid response which resulted in a redirect

In my project, I am utilizing angular4 for the frontend and a spring boot application for the backend. The communication between the frontend and BFF (backend for frontend) is done via RESTful requests. When the frontend sends a POST request to the backen ...

Include certain variables in the JSON response within the Aspect

Our goal is to include some variables in the JSON response, embedded within a specific aspect. We are looking to implement a process similar to this function, but focusing on modifying the response rather than the request. ...

Can anyone help me with displaying auto complete HTML files in VScode?

As a Korean, please excuse my lack of proficiency in English. This image displays the autocomplete feature for HTML files in IntelliJ. This particular file was generated by Spring Boot (start.spring.io). How can I achieve the same in VSCode? ...

Discover an Effective Approach for Transmitting Form-Data as a JSON Object

Hey there! I'm encountering a bit of an issue with sending some data as a JSON object. The problem arises when trying to send images using FormData. It seems like I need to convert my form data into a single JSON object. Can anyone assist me with this? Tha ...

Guide to Testing a Vue.js Application by Simulating API Requests in the Browser

My project involves an app with Vue.js on the frontend and Spring-boot on the backend. I am looking to perform "unit testing" or integration testing of my views by utilizing a browser and Selenium, while also mocking API calls (ajax requests). What tools ...

What is the best way to verify the JSON request in a Spring Boot application?

I need to verify the JSON request I receive from the client side. Despite successfully using annotations like @notnull and @length(min=1,max=8), I am struggling to access the specific fields and error messages that are triggered when validation fails. Alth ...

Retrieving specific information from the Model and returning it as a JSON response using annotations

I am interested in receiving a JSON response with additional annotations. Currently, my JSON response looks like: { "id": 1, "startDate": [ 1993, 12, 12 ], "endDate": [ 2018, 11, 22 ], "totalDistance": 255, "totalPrice": 211 } How ...

Spring does not perform validation on JSON requests

Whenever I make the following request: "Person": { "name": 5 } The request will fail as it is a bad request since 5 is not a string. It displays: Person{name='5'}. Similarly, no error occurs when null is sent. The annot ...

Can multi-page applications be developed using Angular?

As I contemplate developing a food ordering application similar to Zomato, I have observed that Angular-like routing is used on certain pages, specifically during the ordering process after selecting a restaurant. Unlike other sections where server routing ...

The static files in Spring Boot's web main resources are not automatically reloading when changed outside of STS

I'm currently working on an AngularJS project using Spring Boot, with the HTML/JS/CSS stored in src/main/resources/static. The issue I am facing is that when I make changes to these files outside of Eclipse and then refresh the browser, the changes d ...

Angular application hosted on Apache2 with SSL configured to communicate with a Spring Boot API running on port 8080

After developing a small application using Angular and an API with Spring Boot that includes an embedded Tomcat server, I decided to deploy them on a Raspberry Pi while configuring an SSL certificate with Let's Encrypt. The deployment process involved ins ...

Incorporating Node modules within a Spring Boot executable JAR

I am currently working on a Spring Boot application with a React front end. In my project, I have node dependencies managed by package.json and Spring Boot dependencies handled by Gradle. As I prepare to build a jar for my production environment, I am unc ...

Is there a way to dynamically change the options in a dropdown menu using Angular?

I am facing an issue where the values in my dropdown list are changing to null when I click on the form. The add function is working correctly, but this update problem is bothering me. Can anyone provide assistance? Below is the snippet of my HTML code: ...

Implementing Ajax calls in Spring Boot with Thymeleaf

I am attempting to make a Spring Boot controller call from an Ajax Request: $('#female').click(function(){ $('#analysisTable').DataTable( { "ajax": '/analyse/female' }); }); The purpose of this is to populate a list within a js datatable. Th ...

Angular Service worker mishandles http redirects (302)

In my current project, I am implementing Angular and Spring Boot technologies. When I build the project, Angular generates the service worker for me. The issue arises when I use an external service (auth2) and my backend redirects to the login page after ...

The preflight response is denying the request header field ack, despite the server permitting it

This question has been circulating on various platforms, but this one is a bit unique. I encountered an error while attempting to access a Java API using axios with the following code: axios .get("http://127.0.0.1:8090/api/v1/homescreen") .the ...

The Spring Boot application is having trouble retrieving static files

I started a fresh springboot project and organized the directory structure as follows: view image description here The yml configuration is outlined below: server: port: 8783 servlet: context-path: /spring-demo spring: scan : com.example appli ...

The use of credentials is not allowed when the ‘Access-Control-Allow-Origin’ CORS header is set to ‘*’

My Java web application makes CORS requests where the browser performs an OPTIONS preflight before the actual request. The format of each request is as follows: Host: localhost:8080 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:63.0) Gecko/2 ...

Decoding JSON data into Java objects with RestTemplate and Jackson

I'm facing some challenges with deserializing JSON into Java objects within a Spring Boot 1.5 application using Jackson. Below is an example of the JSON response, which is an array containing a single JSON object with nested attributes: [ { "deploy ...

Transmitting Map data from Ajax to a Spring controller poses a significant challenge for me

I need assistance with implementing a function to send map data to a Spring Controller via ajax. However, I am encountering an issue where the received map data from the controller is empty. The size of the map is currently 0... Please help me resolve t ...

Spring Boot - The Ultimate Guide to Hosting Angular2 Compiled Files

Currently, I am using a Spring Boot restful server alongside an Angular2 front-end application. In an attempt to streamline the process, I have been trying to host the front-end files on Tomcat in order to avoid serving them separately. Unfortunately, desp ...

Why is the Ionic 3 HTTP request malfunctioning on iOS, while functioning correctly on Android?

I have developed an application using Ionic 3 that connects to a Spring Boot API for user authentication. The Spring Boot application is hosted on AWS and the functionality works perfectly on Android devices. However, when testing it on iOS, I encountered ...

Spring Boot does not validate JSON data types

Here is an example of a JSON data structure: "name": { "title": "Mr", "firstName": "somename", "middleName": "middleName", "lastName": "Micheal", "maid ...

Send JSON information to a Spring Boot server application

I am brand new to working with Spring Boot. Currently, I am attempting to send registration form data (in JSON format) from a Vue frontend to a Spring Boot backend. However, the backend always indicates that the received data is null. How can I properly re ...

Displaying the contents of an ArrayList in a Spring Boot application

After creating an ArrayList with the JSON values from a Rest API, I encountered the following code to read the Rest API: @RestController public class exemploclass { @RequestMapping(value="/vectors") ...

json remove unnecessary detailed timestamps

I need to develop a service that only returns JSON with date, time, and minutes, but the current implementation is displaying everything including milliseconds and seconds in the timestamp. How can I remove the milliseconds and seconds from the output? Be ...

Encountering a 403 Forbidden error in Spring Boot while attempting to upload an image to the server via a POST request

Currently, I am facing an issue while trying to upload photos into the database as I keep encountering error 403. Interestingly, everything was functioning smoothly when I tested the endpoint using POSTMAN. However, upon creating the axios request, the err ...

Custom Error Page Implementation in Angular and Spring Boot

I keep running into a Whitelabel Error Page (error 404) whenever I attempt to access any page on my Angular 9 application, except for the root route. Interestingly, using the page buttons within the Angular router functions perfectly fine. Despite trying ...

Spring Boot application making REST requests with JSON payloads containing duplicate parameter names

Is it possible to detect in Spring REST if the input JSON contains a parameter multiple times? For example, if we have the following controller: @PostMapping("/") public void handle(@RequestBody Id id) { ... } Where the object Id is a classic POJO pub ...

Navigating through documents in Jhipster (Angular + Springboot)

After successfully developing a controller and service in the backend using Spring, I have managed to implement file upload functionality on the server. To determine the upload location, I utilized System.getProperty("user.dir") to retrieve the current pr ...

Trouble encountered while setting up CORS in Spring Boot and ReactJS

Having thoroughly reviewed all the MDN documentation on CORS, I am attempting to retrieve resources from a Spring Boot server at localhost:8080 within a ReactJS application at localhost:3000. However, I am not receiving the expected response. Here is the c ...

What is the best way to transfer information between Ajax and a RestController in a Spring Boot application?

I am looking to utilize Ajax to send data to a RestController using the POST method for processing, and then return the resulting list back to Ajax. Controller @Controller public class AjaxController { @GetMapping("/web") public String web() ...

Is it possible to run both a Spring Boot JAR and Next.js app on the same port within a packaged JAR

Is it possible to run NextJs code on a different port like 3000, and have it combined with Springboot in an executable Jar/WAR (with embedded Tomcat) running on default port 8080? Can the combined application jar/war be configured to run on a single port? ...

When IntelliJ starts Spring boot, resources folder assets are not served

I'm following a tutorial similar to this one. The setup involves a pom file that manages two modules, the frontend module and the backend module. Tools being used: IDE: Intellij, spring-boot, Vue.js I initialized the frontent module using vue init webpac ...

Encountering an issue when attempting to convert data to JSON in Angular 13, as the content type 'text/plain;charset=UTF-8' is not supported. This problem arises after sending data from

I've been attempting to submit a form using the following method: saveBuildcompany(): void { // @ts-ignore // @ts-ignore console.log(this.group?.value); let data2=this.group.value; let serializedForm = JSON.stringify(data2); ...

Can Spring Boot be set up to return JSON instead of HTML for InvalidTokenException when configuring OAuth2?

When testing my Spring Boot application, I realized that querying one of my REST endpoints with an invalid token using Postman resulted in a response content in HTML format instead of JSON. The endpoint correctly responded with 401 InvalidTokenException, b ...

Leveraging Sessions in Angular with Spring Boot

As I try to implement a login and session management system for my library portal, I have developed backend services using Spring Boot and frontend with Angular. While exploring an example of Spring Boot + Session Management on this link: , I made some adj ...

Exploring the concept of multi-tenancy with Spring Boot and React

I am currently working on building a REST API using spring boot with React as the frontend. The goal is for React to send GET or POST requests from the frontend in order to make modifications to the MySQL DB located in the backend through the REST API. W ...

Encountering issues with Gzip compression in my Spring Boot 1.5.10.RELEASE project

I am currently running on Spring Boot version 1.5.10.RELEASE, but I'm facing issues with Gzip compression not working correctly. When accessing http://localhost:9000, it redirects to http://localhost:8080/api/.. My AngularJS and REST API are on dif ...

The API response includes a JSONObject indicating that the value for "empty" is set to false

I am currently working on a project that includes the following code snippet: @SessionScope @RestController public class cdaDisplayTool { private final static Logger LOG = LoggerFactory.getLogger(cdaDisplayTool.class); @PostMapping(path = "/d ...

Utilize Angular roles to sort and organize website data

Exploring the utilization of login roles in my Angular SPA application which operates solely on the client side, integrated with Spring Security and Spring Boot. I have concerns about potential unauthorized access by a skilled developer who could manipula ...

Get a List exported as an Excel file using Spring Boot and Nextjs

I am attempting to implement a feature in my Nextjs frontend where users can download a list as an Excel file by clicking on a button. The backend of my application is built using Spring Boot, and I need to send the file from there so that users can downlo ...

Using Spring Boot to create a multiple select feature with Materialize CSS

Currently engaged in a Spring Boot project utilizing Materialize CSS for the frontend. Everything runs smoothly when running the HTML file independently, with the Materialize CSS multiple select feature working perfectly. However, upon integrating the HTML ...

Sending a parameter to the window.onload callback function

Is there a way to pass parameters from ModelAndView to a window.onload function in JavaScript within an HTML file? Here is an example of how it can be done: @RequestMapping(value = "/admin/printtext") public ModelAndView printtext() { ModelAndView mo ...

What steps can be taken to resolve the issue of CORS in react spring boot integration?

I have implemented a CORS filter class in my Spring Boot application: @Component public class CorsingFilter { @Bean public CorsFilter corsFilter() { final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); ...

Learn the process of converting C# code to Kotlin with the incorporation of a Json library

Hello, I am new to Kotlin and apologize for my poor English. I am trying to convert the code snippet below to Kotlin. However, I am having trouble finding the equivalent of [JsonExtensiondata] in Kotlin. public class ProofAttribute { [JsonProperty(&q ...

Is it possible to deserialize this Json to the specified Java Dto using Jackson ObjectMapper without the need for a custom @JsonCreator?

I have created two Java classes named Request and Item: public class Request { private List<Item> subItems; public Request() { } public List<Item> getSubItems() { return subItems; } public void setSub ...

Exploring the Functionality of Spring Boot GUI with Selenium WebDriver Testing

After developing a Spring Boot / Angular JS app, I am now looking to implement GUI interface tests. I decided to utilize the Selenium ChromeDriver, so I included the Selenium dependency : <dependency> <groupId>org.seleniumhq.selenium</ ...

Converting int arrays into JSON for Spring RequestBody handling

I am facing an issue with my Spring controller method that requires a @RequestBody as a parameter. The structure of the request body class is like this: public class myClass { CustomObject obj int x int y int[] values Character c ...

Unsupported Media Type: 415 Error during MultipartFile Upload

When trying to upload a file using spring boot and vue, I encountered an error '415 : Unsupported MediaType'. This is the snippet of my spring boot controller. @PostMapping(consumes = {MediaType.MULTIPART_FORM_DATA_VALUE}, produces = {MediaType.APPLICATIO ...

Blueprint for constructing an optimal Angular and Spring Boot application.Creating a streamlined process for

I am currently working on constructing a spring boot/angular application. My goal is to run it locally in order to work on the front end login/logout process. To do this, I have angular set up to run on port 4200 and spring boot running on port 8080. How ...

Customizing the HTTP request error message in Spring Boot to display a custom message instead of the default 400

As I work on developing a Restful API with JSON responses, I have enabled Https by default for security reasons. However, whenever I attempt to access endpoints using the http protocol, I receive a 400 error message indicating: Bad Request This combinati ...

Reat is having trouble sending a POST request to a Spring Boot application

Encountering an issue: I have a Spring Boot API set up with various endpoints and a filter to determine access with or without a JSON Web Token. Postman works as expected, returning the correct data, but React seems to struggle with it. The root cause of t ...

Learn how to extract Json values through the use of underscore (_) concatenation

Is there anyone who can assist me in extracting data in a JSON format like this: {"EMPLOYEE_DETAILS":"1-abc_xyz"} instead of the default format like {"id":1, "firstName":"abc", "lastName":"xyz"}? The data should be retrieved from a specific column. For i ...

Utilize dynamically generated Java Strings to assign JSON values for effective Karate integration testing in a dynamic manner

For my Karate Integration testing, I am looking to set randomString/randomNumber as Json values instead of hardcoded ones for the payload using the PUT HTTP verb. Additionally, I would like to store these JSON values in a database. ...