Questions tagged [spring]

The Java platform is empowered by the Spring Framework, an open-source framework designed for application development. This robust framework excels in supporting component-based architectures and boasts a diverse collection of more than twenty seamlessly integrated modules.

Spring REST service prevents Cross-Origin Requests with AJAX

Having Trouble Accessing Spring REST Service My spring service @RequestMapping(value = "/MAS/authenticate", method = RequestMethod.POST) public ResponseEntity<Map<String, String>> authenticate(@RequestBody Subject subject) { Map<String ...

Utilizing Spring and JPA to Store Data in a JSON Column within a Postgres Database

My database table "test" in Postgres 9.3 has a column named "sample_column" of type json that I'm trying to populate with {"name":"Updated name"} using Spring / JPA. After researching, I found that I need to implement a custom converter to map the string ...

The controller is unable to accept JSON data from the JQuery.ajax function

I have thoroughly checked my web.xml and spring-servlet.xml files, but I couldn't find any issues. I then reviewed my Controller and .ajax() call, but still couldn't identify the problem. I experimented with using JSON.stringify, @RequestParam, adding a js ...

Exclude the map entry from displaying in a JSON document

I am currently working with the following endpoint: @RestController @RequestMapping(value = "/info") public class InfoEndPoint { .... @Autowired public InfoEndPoint(....) { .... } @RequestMapping(method = RequestMethod.GET) ...

A step-by-step guide on transforming JSON into Plain Old Java Objects (POJOs) in

Currently, I am working with spring 3.1.2 and I have a task of parsing a json object into a POJO. Here is the specific json content that requires parsing: { "Person" : { "id" : "2" }, "Dog" : { "dateOfBirth" : "2012-08-20 00:00:00", "price" : ...

Building a web application with Spring Boot while incorporating the use of Selenium WebDriver

As I delve into the realm of spring boot, I find myself facing a challenge in integrating selenium into my application. The goal is to create a basic web page with an input box and button. Users should be able to enter a URL in the input box, which will th ...

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</ ...

There seems to be a caching issue in ReactJS and Spring Data Rest that could be causing problems with

Encountering an unusual caching problem here. Just recently wiped out my database. While adding new users to the system, an old user mysteriously reappeared. This user has not been recreated and is not in the current database whatsoever. I'm at a lo ...

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 ...

Submitting a form with a Date input field

I'm working with a form that looks like this: <form:form method="POST" modelAttribute="lostcard" action="enregistrerLostCard" id="formCard_Lost"> [...] <form:input path="dateDeclaration" type="text"/> [...] <input value="enregistrer" ...

CORS has prevented the redirection

As I am sending a redirect from a POST API to an adfs server via HttpServletResponse containing a URL with status 302, I encountered the following error: The XMLHttpRequest cannot load Resource A. The redirect from Resource A to Resource B has been bl ...

One way to have a Spring RESTful API return JSON in its true format rather than as a string is by serializing the

Currently, I am developing a RESTful API using Spring. The API structure is such that it displays all objects of its corresponding type. You can access the API at the following link: The Data Transfer Object (DTO) for this API is as follows: public class ...

Utilizing the Jackson Framework in Spring Boot for effective mapping with @RequestBody annotation

Hello everyone. I am dealing with some data fetched from a jQuery DataTable and sent to a Spring Controller using Ajax. The ajax function snippet looks like this: $.ajax({ url: "../todaydatarecover.json", t ...

Exploring AngularJS capabilities: Retrieving data and headers from an HttpResponse

Currently, I have a REST API developed using Spring Boot. In the frontend, AngularJS 1.5 is being used. The login service not only sends data but also includes a header. I am wondering how I can effectively read both the data and header on the AngularJS ...

Spring MVC - The Servlet dispatcher encountered an error: java.lang.StackOverflowError

I originally developed an AngularJS + Spring MVC application, named A. I duplicated this web application by copying and pasting the project folder into another one called B. After running both applications, I noticed they exhibited identical behavior. My ...

Spring Boot fails to recognize path variable data sent from Angular

When working with Angular 7, I encountered a situation where I needed to pass a value from the service class of Angular. Here is how I achieved it: executeHelloWorldBeanServiceWithPathVariable(name){ console.log("name coming from here"+name); retu ...

Is there a way to route an angular request through a spring filter prior to validation?

I'm currently working on implementing an XSS Filter in a backend application (built with JAVA and Spring). The goal is to validate input values from a frontend app (AngularJS) against the filter before proceeding to validate the rest of the content. My cu ...

Are Java classes specifically designed to handle the responses from Camunda's Rest API available?

Currently, I am setting up REST calls from Spring to my local camunda instance using the camunda rest api. This is how I've configured it: I have launched a local camunda docker container on localhost:8080 following this link: (I have verified t ...

What is the process for retrieving user information following REST authentication on the client side?

In my setup, I have a Spring REST backend that communicates with an Angular frontend. For authentication, the frontend sends a POST request to the "/login" URL with the username and password in the request JSON body. The backend responds with an OK code, ...

Encountering issues in inserting data with duplicate IDs in a many-to-many relationship

I currently have a situation where I have two entities, Movie and Actor, that are linked together in a many-to-many relationship. Here is the definition of the Movie entity: public class Movie { @Id private String imdbId; @ManyToMany(cascade ...

Guide on using Ajax and spring MVC to dynamically fill a modal form

One JSP page displays database results in a table on the browser, allowing users to edit or delete each row. I want to implement a feature where clicking the edit link fetches specific customer data from the database using Spring MVC and Hibernate, display ...

Jackson's @JsonView is not functioning properly as per expectations

Currently, I am working with Jackson JSON 1.9.12 in conjunction with SpringMVC. As part of this, I have created a data transfer object (dto) with JSON fields. To have two profiles of the same dto with different JSON fields, I took the approach of creating ...

Dealing with null object values during Jackson parsing

I am currently utilizing the Jackson library and attempting to accomplish a task as described here BaseOperationRequest.java @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "command" ) @JsonSubTypes({ ...

Uploading Multiple Parts to Spring REST API with Angular Factory Service and $resource Module

I am currently using AngularJS to interact with a RESTful web service (which is powered by spring boot) via $resource. My goal is to upload files and send form fields in a single multipart post request, but I encountered the following error: When trying ...

An error was encountered at line 52 in the book-list component: TypeError - The 'books' properties are undefined. This project was built using Angular

After attempting several methods, I am struggling to display the books in the desired format. My objective is to showcase products within a specific category, such as: http://localhost:4200/books/category/1. Initially, it worked without specifying a catego ...

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 ...

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 ...

When using UI-Bootstrap, the modal window does not close when the browser's back button

Recently, I have been working on a project that involves displaying popups. I came across an issue where closing the popup using $uibModalInstance.dismiss('cancel') works perfectly fine on all pages except when trying to close it using the browse ...

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's MVC framework encountered a 400 Bad Request error when processing an

Encountering a recurring issue with receiving a 400 Bad Request error during Ajax requests. It's puzzling as to what could be causing this problem. The technologies being used include: <dependency> <groupId>org.codehaus.jackson</groupId ...

Building a JSON tree model in a Spring application using a list

I'm struggling with JSON. I have a user_id from the client-side and need to check the groups associated with this user_id. After retrieving data from the database, I place it into a list. I have included this annotation in my xml file: <mvc:annotatio ...

Mapping fields in Spring to JSON can be tricky, especially when dealing with fields that can be

In my object, there is a String value field which can contain either true or false. The issue arises when Spring/Jackson maps this to value: "true" as a String, causing problems with certain angularjs ng-model mappings that expect a boolean. Is there a way ...

Communication between the Node development server and the Spring Boot application was hindered by a Cross-Origin Request

Here is the breakdown of my current setup: Backend: Utilizing Spring Boot (Java) with an endpoint at :8088 Frontend: Running Vue on a Node development server exposed at :8080 On the frontend, I have reconfigured axios in a file named http-common.js to s ...

Using AngularJS to organize and present nested array elements within a table display

In my application, I am utilizing Spring MVC and AngularJS. In a specific table, I need to display multiple values from an array inside the same <td>, but I am unsure of how to achieve this. To provide better clarity, here is an example: <ta ...

Integrating Angular 2 with Java functionalities and JSP

Starting my journey with the Angular 2 framework, I recently dove into working with it. As I delved deeper, many questions began to surface. My initial step was creating an Angular project using the Angular CLI, which went smoothly. However, when I attem ...

The media type provided is not supported for submitting form data to the spring server

I am facing an issue when trying to upload a file to a remote spring server through an API. Despite converting the data into form data, I keep receiving an unsupported media type error (415). Below is the HTTP post request using express: var FormData = r ...

AngularJS encounters an error message stating, "The data being posted is invalid in syntax according to the client."

Angular post request $http({ method: 'POST', url: '/DineOut/send', contentType:'application/json', dataType:'json', data:JSON.str ...

Obtaining a document using Angular and Spring MVC API

Having trouble downloading a file upon clicking a button using Angular. The downloaded file is showing as 0 KB in size and won't open. This is the code snippet I'm currently using with Angular and Spring MVC: Angular : public downloadFile(file ...

Sending a post request to a Spring controller with ajax: Step-by-step guide

I am having trouble sending a post request to the spring controller using ajax. It seems that something is not working correctly. If anyone can help me figure out what I did wrong, I would greatly appreciate it. $("#myprofile").on('submit&ap ...

Can an image and text be sent together in a single Json object to a client?

I'm working on a personal project and I want to send a Json object containing an image along with other data to the client. Is this feasible? If not, can I encode the image as a byte array or base64 and have the frontender decode it back into an image, o ...

Spring controller experienced a 404 not found error when making a jQuery AJAX call

I am new to Spring and I have generated a JSON as shown below: [ { "customer" : "16", "project" : "19", "phase" : "47", "approver" : "5", "date1" : "", "date2" : "", "date3" : "", "date4" : "", "date5" : "", "da ...

Timeout in session - Spring boot and Angular app receives HTTP Status code of -1

Currently, my application utilizes spring boot and angular. I have implemented a session timeout handling in the "ResponseError" function of Angular Interceptor. On the server side, I have included an HTTPSessionListener. In order to test this timeout sce ...

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 ...

The combination of spring, cucumber, and Selenium's fluent wait is causing my driver

I am attempting to implement fluent wait in my code @Component @Scope(SCOPE_CUCUMBER_GLUE) public class UserCreationPageImpl extends BaseBinariosPage implements UserCreationPage { Wait<WebDriver> wait = new FluentWait<WebDriver>( driver ) ...

Exploring the Depths: A Guide to Selecting Nodes in Java Based on Depth

In my current JSON representation, I have the following structure: { "total": "555", "offset": "555", "hasMore": "false", "results": [ { "associations": { "workflowIds": [], "companyIds": [], "ownerIds": [], ...

Submitting a form without uploading a file in Spring MVC: A step-by-step guide

When working with a form that includes input text fields and an input file field for database entries, I encountered an issue when creating a second form to edit the same entry. The data was retrieved from the database and filled into the new form, mirrori ...

After making changes to the message converters, Jackson and Spring web are encountering issues with deserializing unquoted strings

In my spring controller method, I am accepting a String as the entire RequestBody like this: @RequestMapping(method=RequestMethod.POST) public @ResponseBody DTO method(@PathVariable("userId") long userId, @RequestBody String page) { // Co ...

The view named 'HelloWorld' could not be found within the servlet named 'dispatcherServlet'

I have recently started learning Spring Boot. My goal is to display an HTML page, but unfortunately I am facing some issues. When I change HelloWorld.html to HelloWorld.ftl, I am able to display the FTL page. However, the vue.js file is not being resolve ...

How can you configure the request section for a POST request using angular-file-upload and Spring?

Regrettably, the solution provided in this answer does not resolve my issue. It seems that the request parameter file is missing from my POST request for some unknown reason. I am attempting to upload any type of file, be it binary or text, using a POST r ...

Encountering empty values when attempting to submit information using Spring framework

Recently, I developed a CRUD AJAX REST application using the Spring framework. However, I have encountered an issue where the object sent from the client to the server is being filled with null values. Oddly enough, the client side shows a status code of 2 ...

Creating HTML within a Servlet by incorporating additional quotation marks

Currently, I'm attempting to construct some HTML markup within a Spring controller. Here is a snippet of the code: append(sb ,"<div class=&quot;myDiv&quot;>"); This code snippet ends up generating the following HTML source in the browser: ...

Secure your AngularJS application with Spring Security for AJAX requests and receive JSON response for authentication

Secure Your Spring Application <security:form-login login-page="/login" default-target-url="/myapp" always-use-default-target="true" authentication-success-handler-ref="myAuthenticationSuccessHandler" authentication-failure-han ...

Encountering a HttpMediaTypeNotAcceptableException while making a jQuery ajax request after upgrading to Spring 3.2.4版本

Whenever I attempt to execute a jQuery ajax call, I am facing the HttpMediaTypeNotAcceptableException. The current configuration that I have includes: Within the context (which is in the classpath), I have the following: <context:component-scan base- ...

Encountered an issue while attempting to assess Jackson deserialization for this specific

I am currently in the process of establishing a many-to-many relationship between movies and users. However, I encountered an error while attempting to save a movie: 2017-12-01 16:12:43.351 WARN 17328 --- [nio-8090-exec-5] .c.j.MappingJackson2HttpMessageC ...

Transmit information from an Angular 2 client to a Spring server using a POST request

I'm encountering an issue where the data is null on the server side even though there are no errors. Can someone provide me with an example to help resolve this? Thank you. Here is my client service: import {Injectable, Inject} from "angular2/core"; ...

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? ...

The element type provided is incorrect: it should be a string or a class/function, but an object was given instead

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. I'm currently working on an application using React JS with Spring Boot. I have successfully configured webpack, but I am ...

Is it possible that an object sent as a response body from a Spring MVC application's controller cannot be fetched using the jQuery AJAX method?

After making an AJAX call, the EmployeeBean object is not being returned and no exception is being thrown. Here is the code snippet from the controller method: I am trying to return an EmployeeBean object from this method using @Responsebody @RequestMapp ...

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 ...

Using AngularJS date picker to set value in Spring model setter

When using AngularJS with Spring, I noticed a discrepancy in the date values between my view file and the POJO User object. In my view file, I have used an input type date to bind the "user.dateOfBirth" attribute. When I select a date, it is displayed cor ...

Jackson Library - com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException

Upon attempting to deserialize the Automobile class, I encounter an error where Jackson is searching for a field in the child element within the parent class. How can I ensure that Jackson uses the appropriate child type for deserialization? It seems like ...

Encountered a connection error in the Spring Boot application: net::ERR_CONNECTION_REF

Currently working on a school project developing a Spring Boot application using Restful. The application runs smoothly locally, but when deployed to AWS, I am encountering an "net::ERR_CONNECTION_REFUSED" error for all my GET and POST requests sent to the ...

Having trouble uploading a file with Angular and Spring

The issue of uploading files to BE is causing me some trouble. I have been struggling to get it right, even with the code below: Angular service public saveFile(file: File): Observable<any> { const formData = new FormData(); formDat ...

How can I send a file and a string request using the POST method to a Spring REST controller that accepts byte[] and Strings with Angular

Need help with sending a post method that includes a file and another string request parameter to a spring rest controller using angular. The server controller parameter is set up to receive an array of bytes for the file and another string request wrappe ...

Utilizing Jackson JsonSerializer with the @ResponseBody annotation in Spring for an enum interface

Similar inquiries Spring @ResponseBody Jackson JsonSerializer with JodaTime Usage of @JsonSerialize and JsonSerializer The Issue at Hand In my code, there is an enum defined as follows: @JsonSerialize(using = JSONI18NSerializer.class) public enum Stat ...

Unable to make an AJAX call to a Spring controller

I am currently attempting to make an ajax call to a Spring controller, but I am encountering an Error 405 stating "Request method 'POST' not supported." I have included my code below and would appreciate any suggestions on how to resolve this issue. Here ...

The release of the Angular App within a webjar is causing problems relating to the baseHref

Currently, I am looking to package my Angular frontend in a webjar so that it can be easily imported via Maven into any Java backend. Successful in this task, I now have a Spring Boot backend with an application.properties file showing: server.servlet.cont ...

The spring controller sends back HTML content

Currently, I am working on a project involving Spring MVC, Liferay, and jQuery. One issue that I am facing is related to an ajax request (post) which calls a controller method annotated with @ActionMapping. When the ajax callback function is triggered, th ...

Spring Boot is having trouble identifying the JavaScript files

I've incorporated Spring Boot in my project and I'm working with a JSP file that looks like this: <%@ include file="common/header.jsp" %> <%@ include file="common/navigation.jsp" %> <div class="container"> <p&g ...

When attempting to upload multiple files in Spring using ng-file-upload, an empty List<MultipartFile> is encountered

My controller method for uploading multiple files at once is based on a blog post and answers to a question I found online: @RequestMapping(value = "/{user}/attachment", method = RequestMethod.POST) @PreAuthorize(...) public void upload(@PathVariable User ...

Issue with React - Axios get request resulting in empty data response

I have encountered a Null pointer exception while making a get request from my back-end spring project. Despite the path being correct and returning the expected value during unit testing, an error occurs when calling via axios get. ERROR: trace: "ja ...

The "405 method not supported" exception pops up exclusively for Angular/HTML/JSP resources within a Spring Boot application

My Spring Boot and AngularJS application is encountering an issue when trying to access a REST service with a POST method. Interestingly, I am able to successfully hit the service wherever POST is configured for request mapping. However, when attempting t ...

Error in parsing JSON data: Unable to convert a string into a 'java.time.LocalDateTime' type

My request is being sent to an external service that includes an updatedDate property. @UpdateTimestamp @Column(name = "updated_date") private LocalDateTime updatedDate; After receiving the response in my DTO, I attempt to format the LocalDateTime proper ...

The JSON request triggers an unsupported media error in the Spring MVC controller

I'm having trouble sending a JSON object to the server. I've tried various solutions from StackOverflow, but none of them seem to work: On the client side: function submitWOZ(){ var sub = { "idNextexercise": parseInt($('#exList').val()), "user ...

What is the best way to integrate JQuery code with Spring Restful services?

My Spring MVC project incorporates RESTful principles and jQuery code. However, I have noticed that the jQuery code does not work when the project is configured as a RESTful application. Strangely enough, when it is not set up as RESTful, all jQuery code f ...