Questions tagged [spring]
The Spring Framework is an open-source framework for application development on the Java platform. At its core is rich support for component-based architectures, and it currently has over twenty highly integrated modules. For Spring Boot related questions, also include the tag [spring-boot].
spring
211,859
questions
0
votes
0
answers
4
views
When i am. trying to run spring intializr using ./mvnw spring-boot:run. it showing the error
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.3.2:run (default-cli) on project initializr: Unable to find a suitable main class, please add a 'mainClass' property -...
0
votes
0
answers
5
views
Session using springboot
Category page show the msg whenever category is added . i want that whenever user refresh the page it will removed from the webpage(msg).
@Service
public class CommonServiceImpl implements ...
0
votes
0
answers
19
views
Does my design violate the Liskov Substitution Principle?
I'm working on a Spring Boot application with the following structure for sending messages
public interface MessageService {
void send(String message);
}
@Component("SendEmailService")
...
0
votes
1
answer
16
views
Kafka offset incrementing after 10 attempts in Spring boot
We have spring boot application to consume the messages from Kafka and put into DB.
We dont want any error handling to be performed in the application if any exception occurs (like DB down etc) ...
0
votes
1
answer
18
views
File upload into ClassPathResource - IOException
i want to upload images added by admin(add category) into folder in project directory but i try to do so with the help of controller but it throws Unhandled exception type IOException
@PostMapping(&...
0
votes
0
answers
9
views
Why is a Thread-Scoped Bean Injected Instead of a Default-Scoped Bean in Spring Boot?
I recently made a change to my Spring Boot project. I initially had a bean without a specific scope. Due to an implementation that uses threads and the occurrence of concurrency issues, I needed to ...
0
votes
1
answer
13
views
Swagger UI doos not show Authenticate button in Spring Boot
I am using Swagger UI to test apis for Spring Boot on mac. However, the authenticate button does not show up so that I can put JWT token for authentication. How can I solve this issue?
I searched the ...
-1
votes
0
answers
19
views
Why SftpSession from spring-integration-sftp (Spring Boot 3.3.2 ) not able to find folder with relative path over SFTP?
I am migrating a spring boot application from V2.7.18 to V3.3.2 which connects to remote server to perform SFTP operations. The application is able to make SFTP connection post migration, but it is ...
0
votes
1
answer
40
views
Invalid bean definition is defined in class path resource as there is already a Generic bean
I am trying to convert a spring application to springboot application. The application runs fine when I run it using the intellij GUI, but if i use the terminal and try to run it by java -cp command ...
-1
votes
0
answers
63
views
Spring for a library [closed]
I have written a library to provide a Java API for a Rest service with all the fun stuff like RestTemplate, RestTemplateRequestCustomizer, ResponseErrorHandler, etc. I now want to distribute the ...
0
votes
0
answers
18
views
For virtual threads, how to control the number of platform threads via Spring
I need to use virtual threads through SimpleAsyncTaskExecutor and I have the following three questions:
How do I control the number of platform threads used to dispatch the virtual threads?
By ...
-1
votes
0
answers
11
views
How to Implement Configurable Grading Grids in a PFE Dashboard
I'm working on a project for managing grades and evaluation grids for students in PFE internships. The goal is to allow the director of stage services to modify the evaluation grids and grading ...
0
votes
0
answers
15
views
Spring Shell not running interactive mode windows 11 - Unable to create a system terminal, creating a dumb terminal
I'have created simple SpringShell app (java 21 and maven) using spring initializr and created class HelloCommand.java.
While running app in IntelliJ IDEA I'm occurring a warning Unable to create a ...
0
votes
0
answers
16
views
RequestRejectedException: The request was rejected because the URL contained a potentially malicious String "//"
In my attempt to make my web application secure, I was testing the URL "myapp/resources//etc/passwd" to see if it correctly handles any malicious URL. Although the request itself returns a ...
0
votes
2
answers
23
views
Is it possible to expose multiple GraphQL endpoints in one spring boot application?
Does Spring support exposing multiple GraphQL endpoints and having separate schemas for those endpoints?
I found nothing about it in the documentation. I know that Spring supports multiple schemas, ...
0
votes
0
answers
19
views
How to avoid session creation in cookies when going to STATELESS in spring 6
I am using spring security with spring 6(XML based) and tomcat.
Previously i was using session but now i am moving to JWT. I already set it create-session="stateless" in spring-security.xml ...
-1
votes
2
answers
32
views
any scenario's to use @Transactional annotation at Repository delete method?
I am reveiewing the code for one of the senior member for the first peer review so he added @Transactional annotation at custom repository with delete method. The custom Repository delete method is ...
-1
votes
0
answers
25
views
do it acquire hikaricp connection when using repository interface?
spring data redis version: 2.7.18
Defined Repository
public interface MemberCacheRepository extends CrudRepository<MemberPrincipal, Long> {}
refrence link: https://docs.spring.io/spring-data/...
0
votes
0
answers
21
views
How to apply ant_path_matcher on Spring Cloud Gateway MVC?
I'm migrating from zuul gateway to Spring Cloud Gateway MVC.
But I knew that no more patterns like "/foo/**/bar/**" is allowed since ant_path_mathcer is deprecated.
And I want to keep ...
0
votes
2
answers
30
views
Generate access tokens after successful social login with Google
I am implementing a spring authorization server with Spring Security 6. Simple authentication of users registered in a local database is already implemented and generating access tokens perfectly.
I ...
1
vote
1
answer
26
views
How to dynamically assign TransactionalManager for multiple datasources in Spring boot
Say, I have configured 5 DataSources in my Spring application.
Each of those connections have also created a matching bean of type TransactionalManager.
When I declare a @Service annotated classes ...
1
vote
0
answers
34
views
Sprintboot Opentelemetry with spring-boot-starter Error
I am trying to enable opentelemetry leveraging sprint-boot-starter. I added io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter to the build.gradle file. However, the application throws ...
0
votes
0
answers
13
views
How to implement Spring boot 3 webflux switchuserwebfilter
I am trying to implement switchuserwebfilter to impersonate different user in a stateless webflux app using jwt bearer token
1
vote
1
answer
15
views
SpringBoot 3.2.4: sleuth.reactor.instrumentation-type: decorate-queues replacement in micrometer
How to migrate/replace the below sleuth property in spring boot 3 with micrometer tracing?
sleuth:
reactor:
instrumentation-type: decorate-queues
The application is a webflux project
On doing ...
0
votes
1
answer
36
views
How to force XmlMapper to retain the root element?
I have the following minimal code:
final var xmlString = "<parent><child>data</child></parent>";
final var xmlMapper = XmlMapper.xmlBuilder()
.enable(...
0
votes
1
answer
22
views
Spring Security OAuth2 blocks the Redirect URL from Keycloak [closed]
I am integrating OAuth2 authentication using Spring Security and Keycloak in my Spring Boot application. The setup involves a magic link solution where users click a magic link and are redirected back ...
0
votes
1
answer
27
views
Springdoc OpenApi add Classpath Yaml
I have a OpenApi Spec defined in its own library.
This library is used as gradle dependency in my project.
I am using Springdoc v.2.5.0.
My project is a Spring Cloud Gateway.
Currently I am trying to ...
-3
votes
1
answer
49
views
findAll() method in MongoRepository returns an empty list [closed]
MovieService.java
package com.example.movies;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public ...
0
votes
1
answer
43
views
unable to implement streaming while generating response of ollama
I am using langchain4j, PGVector and Ollama (llama3) for my RAG application
there is an API endpoint "/generate" where the user gives a string and it returns the response generated by the ...
0
votes
0
answers
45
views
Spring Redis serialization issue with Spring Security's DefaultSavedRequest class
I am using spring-session-data-redis, spring-boot-starter-data-redis for session persistence in Redis. The Spring Boot version for the application is 3.2.6. I am also using Spring Boot security with ...
0
votes
0
answers
13
views
Spring Batch how to create fixed size file when reading multiple flat files?
I'd like to further extend Reading data form multiple csv file and writing it into one csv file using Spring Batch, in my case I've to read multiple files (with the same filename) from different sub-...
-1
votes
0
answers
34
views
Cannot receive request from Java spring framework [closed]
I'm using CentOS Web Panel on CentOS 7 and currently I have this problem.
My server is intended to receive a push data in XML format from 3rd party using Java Spring, and it return with 403 forbidden ...
-1
votes
1
answer
32
views
How to pass multiple images as @RequestPart in Spring feign client?
I am trying to pass multiple files (images) using feign client. However, when I am using @RequestPart annotation for list or array of MultipartFile, I am getting an error. For a single MultipartFile ...
0
votes
1
answer
34
views
I can't auto login user after registration in spring boot
when i registrate user my project throws stackOverFlowError, but user is saved to database.I also have registration form. Here is my registration controller:
@PostMapping("/register-user")
...
0
votes
0
answers
26
views
Connecting Jconsole to java app on GCP via SSL ( connect to JMX through JNDI )
I'm trying to make a connection to my java app, using Jconsole. I want to secure that by SSL. At the end I want to move this app to GKE and make the same connection.
What I have:
Simple springboot app,...
0
votes
1
answer
17
views
"java.lang.IllegalStateException: org.springframework.cloud.config.client.ConfigServerInstanceProvider$Function has not been registered"
Getting the exception:
java.lang.IllegalStateException: org.springframework.cloud.config.client.ConfigServerInstanceProvider$Function has not been registered
In Spring Cloud Config Server.
Configured ...
1
vote
0
answers
57
views
Spring Boot RestClient as a singleton or create new instances per request
Looking through the documentation here, the expected pattern to use for RestClient is to autowire the RestClient.Builder and then build the RestClient in the constructor method of a service. While ...
-1
votes
1
answer
47
views
Return whole child DTO inside parentDto [closed]
I have class student and school DTO.
Class Student{
private String name;
private School school;
}
Class School{
private String schoolName;
private String address;
}
while returning ...
0
votes
0
answers
25
views
How to Convert a Complex SQL Query to Hibernate Criteria API
I'm learning about Hibernate's Criteria API and would like to know how to convert this particular SQL query to Criteria API. Here is the SQL query I’m working with:
select s1.score as score,count(s1....
0
votes
0
answers
15
views
Any new changes in Angular UI code not reflecting in running war file, generated from Angular and Java Spring code and deployed in wildfly server
I am working on support for one legacy project with below environment:
Client: Angular UI, version: 4
Backend developed in: Spring,
Server: Wildfly
Java version: 8
Below is screenshot of my project ...
-1
votes
1
answer
37
views
How to set the principal name of a Spring Security OAuth2AuthorizedClient using access token response?
I am currently playing around with Spring Security 6's OAuth2 Client in Spring Boot 3.
I am using an authorization_code grant which is exchanged for an access token using the following security config:...
1
vote
1
answer
52
views
Memory / garbage collector issues with Java Spring service
I have a memory issue with a Java service (21) using the Spring framework (3.2.1).
The service is quite simple. It exposes a REST endpoint.
When this endpoint is called, the service makes an HTTP ...
0
votes
1
answer
60
views
4Read file from executable spring boot jar on Java 17
I have a jar with the following structure on my jar:
I am trying to read the file under custom/file.txt but it's throwing me an error:
java.io.FileNotFoundException: URL cannot be resolved to ...
0
votes
0
answers
21
views
Caused by: org.springframework.jdbc.BadSqlGrammarException: Executing query; bad SQL grammar [SELECT * FROM employee where age in (:ageList)];
I'm using Spring Batch XML code in my project where I'm reading from MySQL DB using IN clause and writing it into CSV/CustomItemWriter etc.
Getting below error, it appears that Spring Batch is not ...
-1
votes
1
answer
67
views
java.lang.ClassNotFoundException: Could not load requested class : charset
I am attempting to add spring data jpa to an existing spring boot 2.7.3 web app. We're using hibernate 5.6.9. I've added spring data jpa as a maven dependency via the spring-boot-starter-data-jpa ...
0
votes
1
answer
34
views
Spring @Autowired in mapped object from Jackson ObjectMapper
Is there a way to get @Autowired Objects initialized properly inside a newly created Object that came from objectMapper.readValue()?
BaseEventInfo eventInfo = objectMapper.readValue(eventJson, ...
-1
votes
0
answers
21
views
Spring boot serialize different fields according to users role [duplicate]
I've a spring boot project that is about 90% of development complete and I just faced a new requirement, for one specific endpoint the response must only include certain entity fields if authenticated ...
-1
votes
0
answers
34
views
Getting 404 on several resources or endpoints when using antMatchers instead of antMatcher [closed]
I'm using two configuration classes with different goals.
SecurityConfig
This class manage permissions for all endpoints of my web application:
package com.IOTProjectUI.security;
import java.util....
0
votes
0
answers
31
views
How to pass list in SQL query - Spring Batch Caused by: java.sql.SQLException: Parameter index out of range (2 > number of parameters, which is
Before posting the question - I went through below URLS, but it was clear enough to me
Using SpringBatch JdbcCursorItemReader with List as NamedParameters
How to set list of parameters on prepared ...
1
vote
0
answers
32
views
SpringBootTest with Togglz
I just recently added togglz to the spring-boot 3.1.9 application, which contains also much stuff like spring-security, spring-data, etc.
Maven dependency:
<dependency>
<groupId>org....