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.
198,439
questions
0
votes
0
answers
14
views
Transactions Rollback issue in Spring
Facing an issue while rollback saving data.
Problem:
In my java method there are three saving actions. Data save to different table. I want when a saving fails then all saved transaction will be ...
0
votes
0
answers
21
views
what is the alternative of getThrowableStrRep() in log4j2
In my old code(which is in log4j), we are using
private void hello(LoggingEvent event)
{
String[] eventStackTrace = event.getThrowableStrRep();
}
Now we have to change our code to ...
-1
votes
1
answer
15
views
What does @Value annotation mean in Constructor depedency injection in Spring?
I have a snippet that looks like this
@Component
public class Inspiration {
private String lyric =
"I can keep the door cracked open, to let light through";
...
0
votes
1
answer
24
views
Failed to determine a suitable driver class in CMD
Im developing spring boot Rest API, application,
In my VS code application is running without any runtime errors and working with postman too,
VS code runtime output
enter image description here
...
0
votes
1
answer
13
views
What is the meaning of @JsonManagedReference
Why do I have to annotate a @OneToMany field with @JsonManagedReference, what difference does it make?
0
votes
0
answers
9
views
How do I get the active profile in a build.gradle task for a Spring Boot Project?
No matter what I do, I cannot get the active profile in a build.gradle task when I try:
println property('spring.profiles.active')
I'm running the project by running:
./gradlew bootRun --args='--...
0
votes
0
answers
15
views
Is there a way to get Spring variable substitution inside JPA annotation values?
This works on SQL server:
@Type(type = "json")
@Column(columnDefinition = "NVARCHAR(MAX) NULL CHECK(ISJSON(tags) = 1)")
private List<String> tags = Lists....
0
votes
0
answers
11
views
How to query all posts by tag_id in Postgres ManyToMany Relationship in spring JPA repository?
How to query all posts by tag_id in Postgres ManyToMany relationship in Spring JPA repository?
These are the tables:
post
post_tag
tag
id
id_post
id
..
id_tag
..
If I query the PostgreSQL directly ...
0
votes
1
answer
39
views
Java : Is it possible to set paramters selectively?
Using jdk1.8. I need to set a param in a jpa-native-query based on a boolean value. Something like (Please see the part where based on "addEmail"'s true/false value , trying to set/ignore &...
2
votes
0
answers
20
views
How to throw a meaningful error message from an invalid enum request param in spring boot?
I am accepting an enum parameter to my API but when I use an invalid param via Postman I get blank 400 Bad Request response. I want a meaningful error message like : "invalid Type please insert .....
0
votes
1
answer
14
views
Java SpringMVC - converter.HttpMessageNotWritableException
I'm having an issue of returning a object into an JSON object, from a RESTController of a SpringMVC framework with Tomcat and maven xml, without spring boot.
Here is the exception, when requesting the ...
0
votes
0
answers
10
views
Dependency tracker marks activemq-broker as vulnerable
I use spring-boot-starter-activemq with the lastest version of springboot (2.7.1). Our company's dependency tracker marks activemq-broker which is part of the starter as vulnerable because of CVE-2015-...
0
votes
0
answers
7
views
Getting invalid_client error when trying to revoke an access token in Spring Authorization Server
I am using Spring Authorization Server 0.3.1 and calling /oauth2/revoke endpoint from OAuth client (angular-oauth2-oidc). Payload:
client_id: my-client-id
token: eyJraWQiOiJlYzA3N2Y2OC1jMjQ1LTQ[the ...
0
votes
0
answers
10
views
How to override default userDetailsService and passwordEncoder for spring-boot project
I have this `application.properties' file:
security.basic.enabled=false
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/appdata
spring....
0
votes
1
answer
33
views
Springboot @ManyToMany throws detached entity passed
In my SpringBoot application I created two entities, users and privileges. I also would create a table that associates the id of the users with the id of the privileges they have.
Here my User entity:
...
0
votes
0
answers
14
views
Spring and Keyclock login
I have a problem with spring boot and angular, when I try to make a request with postman and a jwt token gives me a 401 Unhatorizated error. I am trying to access the / home page
1.This is my ...
0
votes
0
answers
13
views
Connect Spring boot with Amazon RDS PostgreSQL
I am getting Error creating bean with name 'entityManagerFactory' defined in class path resource and connect timed out errors while trying to connect to a locally running Spring boot application with ...
-1
votes
0
answers
10
views
Getting failed Healthcheck with latest arangodb-spring-boot-starter
I'm currently running arango-spring-boot-starter 2.3.3.RELEASE. If I try to updgraded to version 2.4-0 (the latest is 2.6-0), the healthcheck fails at startup. I can't find any documentation to ...
-2
votes
0
answers
19
views
How add array list in springboot react ,mongodb app?
The following tools, frameworks, and modules are required for this tutorial achievement:
Java Development Kit 8
Spring Boot 2.0.0
Spring Web
Spring Data
Gradle
MongoDB
React.js
Node.js
Spring ...
1
vote
1
answer
20
views
Implementation for update method in spring boot
I want to write a method for updating a book. The parameters I am passing are updated book and the id of the same book. I am confused about the exact way to implement the update method. Should I pass ...
0
votes
1
answer
8
views
ERROR: org.apache.logging.log4j.Logger.atDebug()Lorg/apache/logging/log4j/LogBuilder
When I try import a file from front to my api, throws this error: org.apache.logging.log4j.Logger.atDebug()Lorg/apache/logging/log4j/LogBuilder
I just have this log4j dependency in my pom.xml:
<...
0
votes
0
answers
8
views
Spring AOP vs proxy
I recently started exploring about spring proxy mechanism. But while exploring I got a bit confused between aspect and proxy. Could you please help me understand that what is the difference between ...
0
votes
0
answers
20
views
No property 'tutorial' found for type 'Integer' Traversed path: Commenti.id
I have the following error... I want to retrieve the properties of one Tutorial from a comment but Spring don't allow me to do that. The relationship is a @ManyToOne... How can i retrieve data of a ...
-3
votes
0
answers
26
views
Why does using float instead of int give me different results when all of my inputs are integers? [closed]
package com.moviemanagerapp.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ...
0
votes
0
answers
12
views
How to use a custom ErrorMessageSendingRecoverer in Spring Cloud Stream
I'm using kafka binder if it matters.
I want to add some custom logic to the recover method of ErrorMessageSendingRecoverer (particularly - to modify a message a bit before publishing it to the error ...
0
votes
1
answer
10
views
How to retrieve the taskExecutionId during a job in Spring Batch?
For logging purposes, I need the (task) execution id inside a job in Spring Cloud Data Flow. In particular, I have access to several "job" objects (JobLauncher, JobExplorer, JobRepository, ...
0
votes
0
answers
11
views
Spring/SpringBoot and Cache Penetration
I found this article about cache penetration in Redis:
Cache Penetration, Cache Breakdown, Cache Avalanches
but the problem is general about cache (so I think EhCache too).
In the article they talk ...
0
votes
0
answers
26
views
Spring Data Mongo: Compare Two Dates in the Same Document
A brief overview of the document I am working with:
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
@Data
@SuperBuilder(toBuilder = true)
public class BreachBrand {
@Id
private String ...
1
vote
2
answers
28
views
Spring doesn't use h2 databases for testing
I have a small database application running on mySQL.
I want to use the H2 for testing.
I added the necessary dependency to build.gradle:
runtimeOnly 'com.h2database: h2'
plugins {
id 'org....
0
votes
1
answer
16
views
sec:authorize not working in spring-boot application
I have this index.html on the resources/templates directory of my project:
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<...
0
votes
0
answers
9
views
Declare multiple routing keys in RabbitMQ
so I'm watching this in my monitor but I don't know which is the proper way to separate different routing keys coming from the same exchange:
Should I use coma or a semicolon as showed in the picture ...
1
vote
1
answer
24
views
Kafka Timed out waiting to get existing topics
Recently started to get Timed out waiting to get existing topics exception in my Kubernetes nod, Kafka Topic that I configured with Spring works perfectly fine locally, can't get my head on thy this ...
0
votes
1
answer
20
views
Use of SimpleJdbcCall to call stored procedure not using the current schema
I'm trying to use Spring JDBC Template to call a stored procedure inside a postgres database.
The connection is done from the yaml configuration file to indicate the current schema to use:
jdbc:...
0
votes
0
answers
16
views
MockMvc ContentType is undefined in Result Action
I am working with Spring 2.7 & JUnit 5 on Eclipse and I have been trying to write a test statement for creating a product. Unfortunately, I am not sure what import statement I am missing (or not ...
0
votes
0
answers
15
views
How to stop spring batch job in validator step
From JobBuilderFactory, I'm using the .validator(...) to check if my parameters are right. It seems that when I throw a JobParametersInvalidException the process continues to the next step. How can I ...
0
votes
0
answers
12
views
Proper argument type for scalar JSON graphql
What is proper input argument type for scalar JSON @Argument?
As the result I have all arguments in my map when I need only my:
My schema.graphqls
scalar JSON
type Product {
id: ID
...
0
votes
0
answers
29
views
403 Forbidden - Spring security with spring boot
I have my spring boot application and I'm trying to add spring security but when I do a request through postman I keep getting a 403 Forbbiden,
Online I found I shoud add: ".csrf().disable()"...
0
votes
1
answer
18
views
is it needed to add init-method in Sprint configuration file if there is nothing to initialize
I am new to Java. I have below java class:-
@WebService
@SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL)
public class ABC extends AbstractWebService {
protected ...
2
votes
1
answer
15
views
How to change context path of spring-boot actuator?
I created a docker container of my spring-boot application with actuator endpoint enabled. Assuming the container runs on port 8080, it is accessible at localhost:8080/actuator, which exposes the ...
1
vote
0
answers
23
views
Replace WebSecurityConfigurerAdapter in Spring boot for ResourceServerConfigurerAdapter
Since Spring Boot 2.7.x version WebSecurityConfigurerAdapter class is deprecated and there is a guide from spring.io on how to replace those classes and use component-based security configuration.
My ...
0
votes
0
answers
12
views
Spring Data JPA - Users and Authorities relationship
Is the relationship between Users and Authorities one to many or many to many?
Why choose one over the other when mapping out the Entities?
Is it just schemantics or will actually one type of ...
1
vote
1
answer
10
views
while initialize the spring boot project IntelliJ idea it is asking to select the dependency
[] 1I am new to spring-boot. After installing the Spring Initializer plugin, I started to create my very first Spring Boot project. While initializing the spring boot project, IntelliJ IDEA asks to ...
-1
votes
1
answer
34
views
Spring boot authentication in 2022
I have trouble with figuring out Spring Boot authentication. I am new to Spring Security and recently WebSecurityConfigurerAdapter got deprecated. Is there a source where basic authentication is ...
0
votes
1
answer
24
views
Redis repository and polymorphism don't work together
I have this code :
@Getter
@Setter
@RedisHash
class Root {
private Base base;
}
public interface Base {
}
@Getter
@Setter
public class Implementor implements Base {
// ...
}
I have a ...
0
votes
0
answers
20
views
How to use DCharts in Vaadin with Java
I created method (component) in java with Vaadin like below:
public VerticalLayout createDchart(){
VerticalLayout verticalLayout = new VerticalLayout();
DataSeries dataSeries = new ...
0
votes
0
answers
45
views
How to get a list from a list of lists in JPA?
I'm trying to get a list of my tv_shows based on Actor Id.
At this moment, this is the only thing I get working (The list of chapters based on Actor Id)
I have tried to do the same with TvShows, but I'...
0
votes
0
answers
12
views
Spring Integration - Message Stucked on Bridge
I have two subscribable channels like this:
<int:channel id="channel1"/>
<int:channel id="channel2"/>
And I have a bridge like this:
<int:bridge input-channel="...
0
votes
0
answers
34
views
Spring Boot + Angular assets
I have a project in Spring Boot which is using the in-built web-server and angular as a front-end. When the Angular application is started, it reads the configuration from env.json which lies in the ...
0
votes
0
answers
13
views
JPA - Create document tree with specific elements from database
I have a web app where you select documents and display them. The document tree is generated from a sql table with a one to many relationship on itself.
What it looks like on the frontend
This tree is ...
-1
votes
0
answers
11
views
How to preverve original context path in apache2 Reverse Proxy?
How can I presrve (or read) the original context path (/test) behind an apache2 reverse proxy?
<VirtualHost *:80>
ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto "...