Questions tagged [spring-boot]
Spring Boot is a framework that allows to easily create Spring-powered, production-grade applications and services with the absolute minimum fuss. It takes an opinionated view of the Spring platform designed to work for new and experienced users of Spring.
134,740
questions
0
votes
0
answers
5
views
Understanding relationship between ConcurrentKafkaListenerContainerFactory and KafkaMessageListenerContainer with RangeAssignor in Spring Boot
In the docs it is stated that after you set concurrency on ConcurrentKafkaListenerContainerFactory you will get that many instances of KafkaMessageListenerContainer. Also, if you use RangeAssignor ...
0
votes
0
answers
12
views
Disallow multiple slashes in a URL in Spring Boot
Is there any configuration in Spring Boot to make multiple slashes in a url unreachable?
Or how to make controller methods handle only correct path values?
Example (such requests should not be handled)...
0
votes
0
answers
7
views
Hibernate 6 Error InvalidDataAccessApiUsageException: Illegal pop() with non-matching JdbcValuesSourceProcessingState
Getting Below error , why calling JPA method, frequently in Hibernate 6
org.springframework.dao.InvalidDataAccessApiUsageException: Illegal pop() with non-matching JdbcValuesSourceProcessingState
at ...
0
votes
1
answer
15
views
I am having a problem with intelliJ not finding the imports
I am having a problem with IntelliJ not finding the imports (and subsequently the classes)
At the moment the code is bare bones and doesn't do anything, I am in the process of practicing my skills but ...
0
votes
0
answers
9
views
Spring boot test throws - java.lang.NoClassDefFoundError: org/springframework/test/web/servlet/DispatcherServletCustomizer
I hope this will not be seen as a duplicate as I have tried other link but all proved futile.
I am trying to run Spring MVC test. After setting up the test class the error in the subject seems to be ...
0
votes
0
answers
5
views
I am migrating spring boot 2.7.3 version to spring boot 3.0.2 where SQSConnectionFactory is not compatible with spring boot 3.0.2 version
** Please find the code snippet below and below is configuration class where we are creating bean of DefaultJmsListenerContainerFactory class**
import com.amazon.sqs.javamessaging....
0
votes
1
answer
11
views
Tomcat 10, Java 17 - JavaMailSender cannot cast one of elements of java.lang.Object[]
After migrating application to Spring Boot 3 and Java 17 I tried to deploy it to Tomcat 10.1.x.
The deployment failed with exception:
Caused by: org.springframework.beans.factory....
0
votes
0
answers
9
views
How to store data on delete in audit table for single entity?
I have a spring boot application which uses JPA and audits the data. When I delete data, it was not storing deleted data except ID in audit table.
I found a solution to add org.hibernate.envers....
0
votes
2
answers
41
views
Performance issue in Spring Boot Java app with SQL Server
I am facing performance issues with a Spring Boot Java App which gets data from a SQL Server database. A simple query like:
SELECT a, b, SUM(c)
FROM table
WHERE date = '2023-02-01' AND year = 2023
...
0
votes
1
answer
16
views
GCE Automation Script Not Working to run Spring Boot Application
I created an instance in Google Cloud Compute Engine (Debian OS) to host a Spring Boot Maven Application. I installed maven.Now while configuring the instance I added below script in the automation ...
0
votes
1
answer
21
views
th:field syntax inside th:each is incoreect
I am using springboot and thymeleaf combination for my project.
Following is the code snippet for Get controller -
@GetMapping("/split")
public String VerticalSplit(Model model) {
...
0
votes
0
answers
28
views
HttpServletRequest body lose after read it once [duplicate]
I'm using HandlerInterceptor to do some processing afterCompletion of request, for that I need request body. Once I read it is not processing further.
@Component
public class GeneralInterceptor ...
0
votes
0
answers
25
views
How to get response from a rest api without calling it directly [closed]
I have three rest API's named A, B and C. A is calling to B and B is calling to C. C has the final response to return back. How to get back the response from C to A.
I don't want C to response back to ...
-1
votes
1
answer
37
views
Sping RestController not responding to request
I am just trying to implement a sample rest controller on spring boot for learning. When i am sending the request through web browser i am getting a white label error.
My applications context path is ...
0
votes
0
answers
9
views
Is there any way to roll back two transaction managers at the end of spring tests?
We can roll back transactions at the end of the tests by adding the @Transactional annotation:
@Transactional(transactionManager = "transactionManager1")
But what if I need to roll back two ...
0
votes
0
answers
12
views
How to make Spring Integrations's Jdbc inbound-channel-adapter to start polling only after a certain event?
In my Spring boot application, I have written below to poll Data from DB .
The data is polled when the Spring boot application is started..
How can I start polling the data on some event?
<?xml ...
0
votes
0
answers
14
views
How to have a single spring scheduler that support multiple timezones?
I have a specific scenario in which I need to run a scheduler at 00:00 AM every day for different timezones. Currently, I am using spring scheduler in fixed rate of 10 minutes so that I will not miss ...
0
votes
0
answers
24
views
How to return same response type for Exception and REST in Spring Boot?
I implemented a global Exception Handler in my Spring Boot app by following this approach.
This approach returns error as ResponseEntity<ErrorResponse> type and here is the ErrorResponse class ...
0
votes
0
answers
20
views
Google Service Account. Unable to get access token for curl post https://oauth2.googleapis.com/token
I am developing an API that connects to Google BigQuery. On my local development workspace, the application starts up fine and I am able to connect to Google Service Account successfully and get the ...
0
votes
0
answers
9
views
i should validate email already exists are not ? using @valid only and it should be display in html webpage
Email already exists or not validation while signup in spring boot and we should use @Valid annotation if email exists it should display on html page otherwise it should save data ?
Using @valid only ...
0
votes
0
answers
8
views
How to poll data from DB using Spring Integration's JdbcPollingChannelAdapter for a certain duration, pass it to a listener through a channel?
I want to poll 100 messages from DB every 120 seconds for which I have written following bean.
@Component
class AccountConfiguration {
@Autowired
@Qualifier("outChannel") // defined in ...
0
votes
1
answer
14
views
How to directly Write in List data type in Ignite Cache on getting value from key ,Cache in the type of IgniteCache<Integer,List<Integer>>
I have my Ignite Cache in form of IgniteCache<Integer,List> cache and I have to put value in list inside IgniteCache directly but when i am trying to put value using cache.get(key).add(value) ,
...
0
votes
0
answers
12
views
@SpringBootApplication not detecting another @Configuration component in the same package
This is my project package structure.
org.myApp
MainApplication.java
org.myApp.controller
org.myApp.repositories
org.myApp.utils
I have a @SpringBootApplication placed in ...
0
votes
1
answer
25
views
Even though I have annotated with @Repository in my JpaRepository interface still I am getting the error
Currently I'm facing an issue in Autowire configuration between Repository and the service layer.
I'm unable to trace my mistakes.
Repository - OrderRepository
package com.kakashi.orderservice....
0
votes
0
answers
11
views
Error while testing with H2 database with Reactive Spring boot
I am using Reactive Spring boot to create a REST API and while the API works perfectly (I have tested it with postman), I also need to write some Unit tests and for the Unit tests I need to use a ...
0
votes
0
answers
10
views
Get notification on react when there is change in the DB notification table using spring boot as back end
As client I need to get notified when there is change in the DB table.
I'm maintaining a notification table
using spring boot
using react.js
can any one suggest me how to approach this solution.
I ...
0
votes
1
answer
19
views
Application scoped bean in Spring
I am learning about bean scopes in Spring and going through this link it says the bean behaves as a singleton across multiple servlet-based applications running in the same ServletContext. I am ...
-3
votes
0
answers
21
views
java problem : the markup in the document following the root must be well formed
I am making a very simple Java web program and here is my problem.
I want to run this Java program in Eclipsem but it has this error as you can see in this picture
my first problem
Here is my src/main/...
0
votes
0
answers
16
views
Convert SOAP XML String to Java Object
I want to convert SOAP XML to Java Object without using xsd files and other stuff. I generate SOAP XML using POJO classes, @Xml annotations. What I want is to somehow deserialize String to not ...
0
votes
0
answers
13
views
Spring Boot Not Invoking SecurityFilterChain
I setup a springboot application and am trying to get basic user logins setup. From everything I have researched, having the @Configuration and @EnableWebSecurity tags are enough to alert Spring about ...
0
votes
0
answers
12
views
Spring Boot: Handling multi step user input for various similar sequences with serialized data
I am currently working on a program that will have multiple different sequences that a user can activate. Still, they all take similar input e.g. (Select a country then a city, or select another ...
0
votes
0
answers
7
views
Error determining TableReference with Hibernate 6 Foreign Key Constraints
After upgrading to spring boot 3 and hibernate 6, I am getting a new error with my entities. I have quite a few with mappings between them, so for the sake of this question I tried to simplify it as ...
0
votes
1
answer
25
views
Failed to configure data source from application.yml in SpringBoot Kotlin
I am using yml file to configure data source. But after executing the jar file, I get the exception. yml works fine if I run project from IntelliJ
application.yml
spring:
datasource:
url: jdbc:...
0
votes
1
answer
43
views
mockMvc cannot mock service for unit test
I am writing a unit test for spring security and JWT validation. There are 3 basic cases I want to start the test with:
When no token -> expect 401
When token but wrong scope -> expect 403
When ...
0
votes
0
answers
9
views
Getting a UnsatisfiedDependencyException In SpringBootTest when trying to convert property (i.e. ${service.version}) to boolean value
I'm attempting to unit test a resilience4j CircuitBreaker, and according to the documentation and my testing, I need to utilize the @SpringBootTest annotation in order to correctly instantiate the ...
0
votes
0
answers
10
views
Spring and Netflix DGS: Access SecurityContext from DgsSubscription Method
We have a custom SecurityService class that internally accesses the current SecurityContext and RequestAttributes via SecurityContextHolder and RequestContextHolder for every method call of the ...
-4
votes
0
answers
24
views
I get this error while running spring boot with intellij ERROR 13240 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed [closed]
2023-02-04 00:41:33.806 ERROR 13240 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to ...
0
votes
1
answer
35
views
JSON parse error: Cannot deserialize value of type `java.lang.Integer` from Object value (token `JsonToken.START_OBJECT`)
How can I solve the error presented?
this is my service :
@Service
public class EmisionPesoService {
@Autowired
private RestTemplate restTemplate;
private final String URL = "https://...
-1
votes
1
answer
35
views
CSRF on POST request [closed]
I'm trying to implement CSRF protection in a Spring Boot application.
I've created the following configuration:
@Configuration
@EnableWebSecurity
public class SpringSecurityConfiguration {
@Bean
...
0
votes
0
answers
20
views
spring-boot 3.0 Discord OAuth2
I want to make a Discord OAuth2 login for my website.
I found following code for an older Spring version on GitHub https://github.com/fourscouts/blog/tree/master/oauth2-discord
I had to add the ...
0
votes
0
answers
30
views
Cannot catch exception in Controller in Spring Boot app
In my Spring Boot app, I implemented a global exception handler class as shown below:
@RestControllerAdvice
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
@Override
...
0
votes
1
answer
29
views
Spring Boot app: Failed to determine a suitable driver class
I tried to connect springboot;
When I run, I get an error "Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured."
My pom.xml
<...
1
vote
1
answer
20
views
Initialize schema for in-memory database?
using latest Spring boot as of time of this writing 3.0.2.
Cannot seem to start in memory database with SpringBatch.
org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "BATCH_JOB_EXECUTION" not ...
0
votes
2
answers
30
views
org.h2.jdbc.JdbcSQLNonTransientException: Unknown data type: "BASE64" when using Oracle BLOB
I use H2 for a while now for productivity improvement during development and testing and I have found it great so far.
However, I have run into an issue that I dont know how to resolve.
My Spring Boot ...
1
vote
1
answer
55
views
How to write unit test for SecurityConfig for spring security
I have a class for spring security, validating token from the user. I got the code from Auth0 website and modified antMatcher part for my configuration. Here is the code:
@EnableWebSecurity
public ...
0
votes
1
answer
27
views
Spring security filter chain is not working
I am using Spring Security to validate my GET and POST requests. The auth mechanisms for GET and POST are not the same. The below snippet is from my SecurityConfigs configure method.
FilterA is for ...
1
vote
0
answers
11
views
How to make swagger-maven-plugin write swagger.json into target/classes in addition to fat jar, so Eclipse can find it?
Our SpringBoot app has a pom.xml that uses the swagger-maven-plugin, and when we run locally with "mvn spring-boot:run", we can view the swagger docs successfully.
However, if we run the app ...
0
votes
0
answers
23
views
Reading Access Key and Secret Access key from AWS Ssm Parameter Store with Spring Boot 2.1 AWS Java sdk v1
Currently we are having access key and secret access key stored in properties file and we are able to make all the Aws service calls, now we want to store access key and secret access key in ssm ...
0
votes
0
answers
11
views
Is it possible to deploy Spring application in SCDF 2.10?
If I have Spring batch jobs bundled within a Spring (Spring version 5.3)application (not a Springboot), Would I still be able to deploy in SCDF-2.10 server, by registering each of these jobs as tasks ...
0
votes
2
answers
30
views
Spring boot 3 + Swagger not working with updated version
Trying to generate swagger UI but not able to generate using spring boot 3.0.2 and java 17.0.2. Below is my details
Gradle dependency
implementation "io.springfox:springfox-boot-starter:3.0.0&...