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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

SpringApplication.run() without boot

I'm a total beginner with Spring. I'm currently trying to just run a very simple project just to start learning about Spring and understanding IoC and dependency injection. At first I created a simple ...
Gaetan L.'s user avatar
  • 649
0 votes
0 answers
8 views

Spring security expression sec:authorize dont work

I want to show a tag for login to an anonymous user and an a tag for logout tu authenticated user that have ROLE_USER im using the sec:authorize but it doesn't do nothing, dont give me error just dont ...
Niccoló Balzarotti's user avatar
0 votes
0 answers
7 views

Spring security return 403 on all POST, PUT request

I write Spring Boot appliction and use Spring security. I'm testing through POSTMAN and swagger UI. GET requests working. But all POST and PUT request return 403 error. I`m disable cors and csrf but ...
Miha5418's user avatar
0 votes
1 answer
4 views

How to check header regex in response with Spring MockMvc

I have the an API that should return a response containing the header HttpHeaders.CONTENT_DISPOSITION with a value that should match the regex "prefix(.*?)suffix". My test: @Test public void ...
Chedva's user avatar
  • 129
0 votes
0 answers
11 views

WebClient call endpoint API twice

@PutMapping() public void calApi() { Map<String, Object> requestBody = new HashMap<>(); requestBody.put("foo", "bar"); webClient .post() ....
minhat's user avatar
  • 11
-1 votes
0 answers
15 views

Turkish characters are not inserted correctly [duplicate]

I have a table with (lockey, trvalue) columns. I just realized that when I insert into the database using, INSERT into myTable (lockey, trvalue) values ('test', 'ııııığçIĞÇ'); the data is inserted as (...
Toprak's user avatar
  • 1
0 votes
0 answers
6 views

Using the Same Trace ID in Zipkin with Spring Boot 3.1.2 and Spring Cloud 2022.0.4

I'm working with Spring Boot 3.1.2 and Spring Cloud 2022.0.4, and I'm measuring metrics with an Eureka Server and Zipkin. However, I've noticed that requests I make to the customer service in Zipkin ...
kemalyuksel's user avatar
0 votes
0 answers
8 views

Specification InvalidDataAccessResourceUsageException after migrating from SpringBoot v2 to v3

I have Spring Data Jpa repository and make call to repo .findAll() with Specification which creates in next public Specification<ProjectMortgageRequest> prepareForBankRegistry(Long bankId, ...
Karp's user avatar
  • 1
0 votes
0 answers
16 views

JPA entity composite primery key not saving to the database

I'm facing such kind of issue. I have this code base. This is my Entity class: @Entity @Table(name = "your_entity") public class MyEntity implements Serializable { @EmbeddedId ...
Hayk  Mkhitaryan's user avatar
0 votes
0 answers
13 views

How to run scheduled task in Spring Webflux without @Scheduled annotation?

I have the following code for scheduled task that which runs after certain amount of time and condition: @EventListener(ApplicationReadyEvent.class) public void scheduleUpload() { Flux.interval(...
jerdys's user avatar
  • 41
0 votes
2 answers
22 views

how to pull movie id(tmdb api) , @PathVarible

I started my first spring boot project. That's why it's not enough. Already looked for stack overflows and googling. I'd appreciate your help. **tmdb api Query For Details ** 'https://api.themoviedb....
sera's user avatar
  • 25
0 votes
0 answers
14 views

Request authorization config in Spring boot security does not work

I have a Spring Boot project with Spring Security enabled to secure my REST APIs using API Key. I have used Swagger to document my APIs too. Spring security config is as follows to force ...
Mohammad Hosein Talaee's user avatar
0 votes
0 answers
12 views

Why null pointer exception was giving in jQuary section please give me brief explanation [duplicate]

this is the problem while I am hitting api it will give this error java.lang.NullPointerException: Cannot invoke "org.hibernate.metamodel.mapping.JdbcMapping.getJdbcValueBinder()" because &...
Bhoma Ram's user avatar
0 votes
1 answer
35 views

How to rewrite Sort.Order parameters for Spring JPA?

I want to rewrite a sort query: So far the query was: ?sort=lastname&sort=... @GetMapping public void getPersons(..., Pageable pageable) { pageable.getSort().getOrderFor("lastname"); /...
membersound's user avatar
  • 81.8k
0 votes
0 answers
17 views

RestTemplateBuilder setConnectTimeout not working

When I use auto-configured bean of RestTemplateBuilder, the timeout field doesn't set as intended. code: public WebHookService(RestTemplateBuilder restTemplateBuilder) { restTemplate = ...
Jiwon's user avatar
  • 1,074
1 vote
0 answers
16 views

Generate Swagger/OpenAPI 2.0 yaml spec file from a Spring Boot 3.0 project

I need to generate a Swagger/OpenApi (preferably 2.0) .yaml spec file for an existing Spring Boot 3.0 restful api project. I don't want to have a swagger-ui page because this project isn't meant to be ...
BlueBoy's user avatar
  • 808
0 votes
0 answers
7 views

JPQL query statement for one sided many-to-many relation in spring with hibernate

I have two entities actor and community with many-to-many relationsip as below: **Actor.java** @ManyToMany( cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) @...
Casio991ms's user avatar
0 votes
0 answers
17 views

PreparedStatementCallback; bad SQL grammar [INSERT INTO BATCH_JOB_EXECUTION_PARAMS(JOB_EXECUTION_ID, PARAMETER_NAME, [duplicate]

I'm working on migration Spring Batch 5. I'm using Jave 17 and Spring Boot 3. I didn't have any issue on step and job. However, In spring batch 5 DefaultBatchConfigurer is removed. setting datasource ...
Arsenal's user avatar
0 votes
0 answers
13 views

Spring relationships returning empty result

I am creating a REST API with spring, and I have a few classes @Table @Entity data class NightShift ( @Id override val date:String, @ManyToOne var mod: Manager, @OneToMany var ...
Christian's user avatar
0 votes
0 answers
24 views

Generic Interface autowaring in Spring [duplicate]

I created a generic interface and several parameterized implementations for it. Then I try to inject a class implementing this interface with a concrete type via the @Autoware annotation but fail. I ...
Sergei S.'s user avatar
0 votes
1 answer
23 views

MockBean does not work with classes in Spring boot 3.1

This is my setup: Spring boot 3.1 JDK 17 I have this simple junit test @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) //@...
Deibys's user avatar
  • 619
0 votes
0 answers
7 views

CXF GetConduit results in PolicyException, but works in a JUnit test

I have the problem that the creation of the HTTPConduit client in a controller or service runs into the following exception org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives ...
true_gler's user avatar
  • 544
0 votes
0 answers
13 views

Why does flyway only work with absolute path for migrations?

Here is my flyway.conf flyway.url=jdbc:mysql://localhost:3306/api flyway.user=root flyway.password=password flyway.driver=com.mysql.jdbc.Driver flyway.locations=filesystem:/Users/auser/Library/Mobile ...
Paul Daniels's user avatar
0 votes
1 answer
15 views

How to save ManyToOne realtion and getting id from another site Java Spring

I'm a beginner and I'm creating a website for booking hotel rooms using Java Spring and Thymesleaf. I have 3 entities: Room, Person, Reservation. User can choose room on "/room" (from ...
newbie5605's user avatar
0 votes
0 answers
8 views

Provide dependency file to a Spring app deployed with Docker

I have a Spring application as a war file deployed in Tomcat. All is done with a docker file. While running the app, I get an exception for this missing file Script resource ste/SteCommon.groovy: not ...
StefanoSKAL's user avatar
0 votes
0 answers
8 views

Trace Id not part of MDC, but is received in Spring cloud stream message headers

I have recently upgraded to spring webflux 3.0.6 with micrometer 1.10.6 micrometer-tracing-bridge-brave 1.0.4 micrometer-tracing 1.0.4 I am consuming a message from rabbitmq where the traceparent is ...
Mukesh's user avatar
  • 1
-1 votes
0 answers
6 views

Saving entities in Hibernate PostUpdateEventListener execution

I am doing an audit of entities' changes and save them into log in a database using Spring JPA (and also Hibernate). To audit updates PostUpdateEventListener is used. The problem is I can not save a ...
Maxim Gaiduchek's user avatar
1 vote
0 answers
22 views

Spring 5 Migration: How to add the suffix .do to all RequestMappings?

I'm migrating a Spring Project from v4.30 with Java 8 to v5.3.x with Java 11 (NOT Spring Boot). All our RequestMappings used the suffix .do via Configuration, the endpoint in this class @Controller ...
Bernie's user avatar
  • 1,617
0 votes
1 answer
30 views

How does the jvm return a Future object reference before the asynchronous method has completed

Consider the following code class Test { public void method1() { CompletableFuture<String> future = helloFuture(); assertEquals("done", future.get()); } } class Service { ...
Abe's user avatar
  • 8,631
0 votes
0 answers
4 views

Original route's filters are still applied to a request after changing the route attribute

I am using spring cloud gateway for my proxy application. I have a global filter which intercepts incoming requests and checks for certain headers and cookies. If it finds that one of the headers is ...
jfulg's user avatar
  • 1
0 votes
0 answers
14 views

Handle multiple content-types/accept headers in request chain

I have the following problem: I have a service A that can request a number of other services (B-E). The services B-E version their resources based on the Accept header which can look like "vnd....
noob123's user avatar
  • 63
0 votes
0 answers
12 views

maven-shade-plugin: How to copy classes under BOOT-INF in the root of the generated jar?

So I have a spring boot application and I am creating a fat jar with the maven-shade-plugin like below <plugin> <groupId>org.apache.maven.plugins</groupId> <...
Da Mike's user avatar
  • 457
2 votes
0 answers
31 views

CORS not working with Spring Boot when MaxUploadSizeExceededException thrown

I'm implementing a REST service with Spring Boot to upload a file making a Multipart POST request. I set a maximum file size in the application.yml as below: spring: servlet: multipart: ...
dascolagi's user avatar
  • 127
-1 votes
2 answers
50 views

Java pojo setter return type is int but getter return type is string

I am creating an API, My controller is public EmployeeResponse(@RequestBody EmployeeRequest reqPacket) { } My pojo class is EmployeeRequest { int age; String name; } So basically my getAge() ...
Intekhab Alam's user avatar
0 votes
0 answers
37 views

Spring ExceptionHandler No acceptable representation

As an api consumer, given header “Accept: application/xml”, I would like to receive 406 response in such a format: { “status”: ${responseCode} “Message”: ${whyHasItHappened} } In the case of ...
robertos's user avatar
0 votes
1 answer
37 views

Spring random cron expression

I want to have a job executed each 1 hour. I have 4 pods running in kubernetes and I'm using this expression: 0 0 */1 * * * Current situation is that all pods execute the job the first minute of each ...
Oussama's user avatar
  • 613
0 votes
1 answer
15 views

How use Oracle SDO_GEOMETRY in SpringBoot

I'm trying to use SDO_GEOMETRY in my SpringBoot entity to store and retrieve Polygon data. Here's the field in my entity: @Column(name = "shape",columnDefinition = "MDSYS.SDO_GEOMETRY&...
sadegh's user avatar
  • 1,720
0 votes
1 answer
21 views

What is the equivalence of org.springframework.cache.ehcache.EhCacheManagerFactoryBean in Spring 6?

I'm trying to migrate my project (jdk 17, tomcat 10.1.12, using xml file for configuration) from spring 5 to spring 6. But I get this error: Caused by: java.lang.ClassNotFoundException: org....
D.Lm's user avatar
  • 29
-1 votes
0 answers
34 views

Why java.lang.ClassNotFoundException: org.bouncycastle.crypto.params.Argon2Parameters$Builder when using Argon2PasswordEncoder

I have this exception when calling the following code: val encoder=Argon2PasswordEncoder.defaultsForSpringSecurity_v5_8() val ok=encoder.matches("password","$argon2id$v=19$m=65536,t=4,p=...
Javaddict's user avatar
  • 481
0 votes
0 answers
12 views

Configure read timeout OpenSearch client

I don't find in documentation how to configure read timeout on an opensearch RestHighLevelClient final CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); ...
Inconvenient9's user avatar
0 votes
0 answers
22 views

Who creates instances I inject mocks into: Mockito or Spring? [duplicate]

I tried to test this: package pp.spring_bootstrap.service; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import pp.spring_bootstrap....
JoreJoh's user avatar
  • 139
0 votes
0 answers
7 views

Why Hibernate second level cache perform put action at each call and takes lots of time?

I have a spring boot 2.7.3 application that uses hibernate, hazelcast as a second level cache factory, mysql. My aim is to use second level cache at find all query and make query faster. There is ...
Furkan Calik's user avatar
-1 votes
0 answers
35 views

SQL Error: 1, SQLState: 23000 When persisting data

I have a two java classes similar to following, @Entity @Table(name = "A") @Data public class A { @Id @SequenceGenerator(name="A_seq", sequenceName="CSS_S_A", ...
Sachi.Dila's user avatar
  • 1,124
0 votes
0 answers
15 views

How to return an aggregate on many elasticsearch documents with Spring Boot Data Elasicsearch?

I have a problem with my Spring-Boot 3.1.1 application + spring-boot-starter-data-elasticsearch version 3.1.1. The index of my cluster is configured as follows: { "mappings": { &...
gcbox999's user avatar
  • 147
-1 votes
0 answers
20 views

How to resolve "java.lang.NoClassDefFoundError: Could not initialize class org.glassfish.jaxb.runtime.v2.model.impl.RuntimeBuiltinLeafInfoImpl"

I am on JAVA 11 and Spring Boot 2.7.15 (starter pom). Also I am explicitly using JAXB-Runtime dependency <dependency> <groupId>org.glassfish.jaxb</groupId> <artifactId>...
Dusayanta Prasad's user avatar
-2 votes
1 answer
36 views

Exporting excel file in spring boot application I need to modify Info "Tags" option [closed]

I am trying to export a file from Spring Boot Application and while I view the Info the excel I need to change the "Tags" value Please find the screenshot for reference How can we manually ...
TechLearner's user avatar
0 votes
0 answers
42 views

Spring Boot 3.1.1 does not recognize some properties in application-<env>.properties file

I'm developing an application with Spring Boot 3.1.1 and it's been configured to support multiple environments. The environment related properties are configured in application-<env>.properties ...
Lahiru Athukorala's user avatar
0 votes
0 answers
16 views

STS v4.20 : Import spring kotlin project from repo but unable to run in STS

I have a spring kotlin gradle project that I created with intellij. All works fine in intellij but when I open with STS 4 the project is not recognized as a spring boot project and I am unable to run ...
hoosain.madhi's user avatar
0 votes
0 answers
8 views

What exactly is the difference between dependency pull and contextualised dependency lookup?

I don't understand the exact difference between the dependency pull and contextualised dependency lookup. From what I understand, dependency pull involves gathering dependencies from a registry ( ...
VARMA PENUMATSA's user avatar
0 votes
0 answers
26 views

OAuth : Is the /oauth/check_token endpoint URI a standard ? How is it different to the /introspect endpoint? [closed]

I am looking at replacing an existing application that currently uses the now deprecated spring-security-oauth2 with the new spring-authorization-server. I know there is no migration path for the ...
jmsjr's user avatar
  • 148

1
2 3 4 5
4180