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.
199,178
questions
1
vote
0
answers
12
views
Recommended way to create an array of Spring Beans
I'm trying to find the most elegant and Spring way to create an (unlimited) of Spring managed beans.
One of the questions is why I'd need to do it. The most common use-case I have is when using Vaadin ...
0
votes
1
answer
17
views
How to use expression advice or error channel for exception handling?
I am new to spring integration. I have to handle few exceptions using spring integration.
we are using xml files for spring integration.
<int:chain id="sample-chain" input-channel="...
0
votes
0
answers
14
views
Consider defining a bean of type 'form' in your configuration
Place that is complaining the error:
@Data
public class AluguelValorForm {
@Autowired
private ValorAluguelMultaService valorAluguelMultaService;
@NotNull @NotEmpty
private String idAluguel;
@NotNull ...
-1
votes
0
answers
22
views
Caused by: java.lang.IllegalArgumentException: authenticationManager cannot be null [closed]
I am following this youtuber and i don't know how to resolve this
https://www.youtube.com/watch?v=TOQjvskdl3g&list=PL2OrQJM8zmZ2-O_rM2Ju9zYMbY8Ta-8I4&index=6
Authority:
package com.cristian....
0
votes
1
answer
24
views
Unit test mockito repository return null
I'm testing dynamodb repository. Here is the method to test
public Book getBook(final String bookId) {
DynamoDbTable<Book> bookTable = getTable();
Key key = Key.builder().partitionValue(...
0
votes
0
answers
21
views
Error null: java.nio.file.NoSuchFileException
I've a problem when I try to read an Excel on memory, this is the error that I have
09:57:46.483 [default task-10] DEBUG mx.com.mi.proyecto.view.MiBean[188] - Valor de ejercicioActual : 2022
09:57:57....
0
votes
0
answers
8
views
Unexpected character ('}' (code 125)): was expecting a colon to separate field name and value when object mapper read value
When I call restTemplate.postForEntity to my rest api like that:
public HashMap<Boolean, Object> find(DriverFindRequestModel findDriverForm) {
HashMap<Boolean, Object> result = new ...
0
votes
0
answers
18
views
Cannot pass data from view to controller spring thymeleaf
I encountered problems trying to pass data from this template:
<form action="#" th:action="@{/pacientes/fechas}" th:object="${fechaInicioFinal}" method="GET"&...
0
votes
1
answer
14
views
Not able to pass Sleuth traceid and spanid to downstream services while making API calls using resttemplate with new keyword
Currently, I am integrating Sleuth into our existing Microservices to enhance the logging mechanism. The MS is built with Spring Boot 2.5.6 and Spring Cloud 2020.0.6 (This has resolved to Spring Cloud ...
0
votes
0
answers
16
views
How to set up azure keyvault for spring boot app?
There was some dependency incompatibility occurring because we were using an older version of azure keyvault (azure-keyvault-secrets-spring-boot-starter 2.2.1) but it got updated and we are upgrading ...
0
votes
1
answer
49
views
How can I Instantiate interdependent lists of Beans in Spring using YML and Java Config?
I'm trying to create a flexible framework for creating components with as much configuration externalized as possible. I'd like to be able to use the YML configuration to define a collection of beans ...
0
votes
1
answer
25
views
Disabling or Increasing Timeout interval for RabbitMQ SpringBoot Amqp Connection Exception in local
I have a spring boot project that uses Spring AMPQ, no issues with hosting, I just want to disable the infinite retry connection locally or at least increase the time between retry attempts.
2022-08-...
0
votes
1
answer
25
views
Spring Integration - Concurrent access to SFTP outbound gateway GET w/ STREAM and accessing the response from Queue Channel
Context
Per the spring docs https://docs.spring.io/spring-integration/docs/current/reference/html/sftp.html#using-the-get-command, the GET command on the SFTP outbound gateway with STREAM option would ...
0
votes
0
answers
12
views
MapStruct Spring Page to custom object conversion includes check
I am using MapStruct to convert a Page object to a custom object of my application. I am using this mapping in order to convert the content field of the Page object to a list of custom objects found ...
0
votes
1
answer
25
views
Spring specification, Criteria API, join and subquery
How can i execute sql query like this through Criteria API and org.springframework.data.jpa.domain.Specification?
select b.id from brands b
where b.id not in
(select b.id from brands b
left join ...
0
votes
0
answers
10
views
Spring Boot JPA repository query that find record which is already deleted unless refresh the webpage
I have a unfollow button that will delete the record. Then the front end will call the second method, but the second method still returns true unless I refresh the web page.
Is it a cache issue? How ...
0
votes
0
answers
12
views
How to use CORS in a @ControllerAdvice controller?
I upgraded my springframework to 5.3.17. I'm getting error - Cannot find symbol AbstractJsonpResponseBodyAdvice. I read that CORS can be used instead of AbstractJsonpResponseBodyAdvice. But i don't ...
1
vote
0
answers
18
views
How to keep Spring boot application running when Oracle connection fails
I have an application written in Spring boot version 2.7.2 and connected to an Oracle database. How can my application still run even if it can't connect to the database (wrong url or dead database)
...
0
votes
0
answers
8
views
Accessing Reactive CRUD repository from MapStruct Mapper stuck in block()
I am somewhat new to Spring and have recently generated a JHipster monolith application with the WebFlux option. My current aim is to make it compatible with Firestore and implement some missing ...
0
votes
0
answers
23
views
can't serve static files spring
I'm really new to spring and that's why it can be very stupid question, but I got troubled with serving static files. I'm creating a REST api for library app and have some logic when user tries to add ...
0
votes
0
answers
18
views
Spring Security Customizing Authorization Endpoint URL
I am implementing a Spring MVC REST web service and attempting to security it with Spring Security Oauth2.
My authorization URL is at the following address (note that there is no registration id):
...
0
votes
0
answers
3
views
Spring Boot many to many relation - How to get an additional property inside the join table as a property from another entity
Im new in Java Spring and I'm stuck at this point here for a while:
I have an entity model like this:
Entity Relation now
A channellist contains many channels. A channel can be assigned to many ...
0
votes
0
answers
9
views
Caused by: org.eclipse.jgit.errors.TransportException: git@devcloud.ubs.net:username/project-name.git: remote hung up unexpectedly
I'm usingg Spring Cloud Config and Spring Boot v2.7.0 server in my coporate work and getting below issue:
Code:
server:
port: 8088
# Needed when you want to use native profile
spring:
# profiles:...
0
votes
0
answers
24
views
How to manually use org.springframework.validation.Validator validate() method?
I want to manually call validate(Object target, Errors errors) method from my validator which implements org.springframework.validation.Validator interface. When I bind that validator with @InitBinder ...
-1
votes
0
answers
14
views
How to continue with spring application after adding the AngularJS 2.0.0 dependency via pom.xml?
am currently learning Java spring boot application with angularJS.
The latest version of AngularJS that I have added through VS Code dependency is AngularJS-2.0.0-alpha.22. Am following a book on how ...
0
votes
0
answers
14
views
Spring Boot app cannot inject / autowire 'javax.enterprise.event.Event'?
I am following a tutorial, where Event is injected like this into the Controller class:
@Inject
Event<ExportedEvent<?, ?>> event;
However, when I run my spring boot application, it ...
0
votes
0
answers
16
views
Spring Data Rest - Bypass @PreAuthorize
I have user repository in spring data rest and I'm trying to create a signup controller. The save method of the repository protected with @PreAuthorize because I want it to be accessible only for ...
0
votes
0
answers
16
views
How to use Micrometer to measure the duration of an async method called from a controller method
I have to measure the full time of the request, that comes into controller and then the async method is executed of some service:
@RestController
public class HelloController {
@Autowired
...
0
votes
1
answer
34
views
JSON parsing using jackson in spring?
I have the following JSON
{
"ads": [
{
"228029_228029": {
"ad_id": "228029",
"duration": 10,
"m3u8_text": {
"...
-1
votes
1
answer
26
views
How not to use UsernamePasswordAuthenticationFilter in Filter Chain?
I am working on a spring boot app where I am adding a custom filter and adding method addFilterBefore.
This is my config configure method:
@Override
protected void configure(HttpSecurity http) ...
0
votes
1
answer
21
views
Spring Cloud Gateway: why route uri property ignored?
I have only this route conf
spring.cloud.gateway.routes[0].id=x-service
spring.cloud.gateway.routes[0].uri=http://localhost:5555/x-service/v1/private/files
spring.cloud.gateway.routes[0].predicates[0]=...
0
votes
1
answer
25
views
Spring property name casing by example
Spring will automatically bind properties defined in application.properties or application.yml to fields defined in @ConfigurationProperties-annotated classes. For instance, in my application....
0
votes
0
answers
16
views
incompatible data type in conversion: from SQL type VARCHAR to java.lang.Long
ERROR [hybrisHTTP15] [FlexibleSearch] Flexible search error occured...
Aug 16, 2022 5:37:53 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [...
0
votes
0
answers
12
views
Spring batch reader changes to read file content from Azure cloud storage
I have a pre existing springboot application like this one(https://github.com/TechPrimers/spring-batch-example-1) which uses spring batch to read a huge CSV file from a local location and inserts the ...
0
votes
1
answer
22
views
Does Juint reset global variables for each test?
I have an integration test class like this (but more complex)
@ExtendWith(SpringExtension::class)
@WebMvcTest(Controller::class)
class ScheduleControllerTest(@Autowired val mockMvc: MockMvc) {
val ...
0
votes
1
answer
32
views
Autowired MockMvc is null with JUnit 5 and Spring boot
I have a class test which send me an error when I run the test.
I followed several threads and I have the right import "import org.junit.jupiter.api.Test"
So I don't understand why it sends ...
-1
votes
0
answers
19
views
How to share ApplicationContext of Spring in multiple web apps?
I have many Spring MVC apps and I want to share same context between them, Or if I could share some certain object between multiple context how can I do that ?
I am using spring MVC with JSF , this ...
0
votes
0
answers
17
views
How to get my Spring Repository to query off one parameter, for two columns, without writing the explicit query?
I would like to know if there is a way, without writing the explicit query itself, to have my method query and filter using only one parameter instead of two.
Example, I have this method and both ...
0
votes
4
answers
60
views
Two way communication between two micro services (spring boot)
I have two micro services M1 and M2, I need to send request to M2 from M1, and I need to wait for the response from M2, because the code works based on the response from M2
How to implement this in ...
0
votes
0
answers
9
views
I cant test my Spring Boot token login API by Postman have header accept
i have a string token and post to header in other tab, but when send request its notice that : Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not parse 'Accept' header {...
0
votes
1
answer
15
views
@DeleteMapping endpoint not triggered at all
My webClient calls work fine with @GetMapping, but @DeleteMapping isn't even triggered. Here are the two methods I'm using:
//works
MyItem myItem = webClient.get()
.uri(url + "/items/" + ...
-1
votes
0
answers
22
views
Filter does not have a registered order and cannot be added without a specified order spring boot
I am working on a spring boot app where I am adding a custom filter and adding method addFilterBefore as addFilter is giving the above specified error.
This is my config configure method:
@Override
...
1
vote
0
answers
55
views
Best practise to save many large images with Spring in 2022 [closed]
I want to save a large amount of images on a server from mobile upload in Java for face recognition.
My question: everywhere on Stackoverflow the opinion is to save image first locally and then ...
0
votes
0
answers
26
views
Migration to Spring Boot is causing problems with Spring Batch
I'm trying to convert an older application that so far only uses Spring to Spring Boot. I managed to get the application to run again. But I'm having problems with Spring Batch.
The application uses ...
0
votes
0
answers
38
views
Spring, How to use repository polymorphism to return all data
I want to be able to create repository based on interface type. I did a little research and I got it work with this code:
interface Animal { }
@Document
class Dog extends Animal { }
@Document
class ...
0
votes
0
answers
8
views
Spring-jcl is writing to wrapper.log. What is the configuration required to redirect to correct file?
This is wrapper.conf. An earlier version was redirecting logs to the correct log file, there was no configuration present. Now all logs are redirected to wrapper.log
Removed most of the jar inclusions ...
0
votes
0
answers
34
views
Could not determine type for: java.util.Map, at table: Film
I made an application/website were you can rate movies and see the ranking of the movies based on the ratings given by the users.
I first made the application without a connection with the database ...
0
votes
0
answers
19
views
Spring boot, Mysql and gradle base application "Error creating bean with name 'dataSourceScriptDatabaseInitializer'
I am new in Spring framework, trying to connect my application with mysql database but getting following error, if I try to run the application by command
gradlew.bat bootRun
from project root ...
0
votes
0
answers
11
views
Spring Cloud Gateway: is it possible to call OncePerRequestFilter before GlobalFilter?
Is it possible to use OncePerRequestFilter before GlobalFilter in the gateway app?
How?
OncePerRequestFilter is not being called.
1
vote
0
answers
25
views
Elasticsearch 8.3 configuration in Spring Boot
I have been trying to implement Elastic Search 8.3 with spring boot.
i am getting the below exception:
Cannot convert value of type 'co.elastic.clients.elasticsearch.ElasticsearchClient' to required ...