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.

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

How to write test for this put method

I have a put method, which takes an "Accept" header with value "application/json", and a requestBody class, and returns a ResponseEntity class. Can anyone tell me how to write ...
0
votes
1answer
21 views

My log in account is not valid in spring boot

I want to log in with the accounts provided in userdetails method in spring boot, but it is not working. Here is my WebSecurityConfiguration class. It is giving me bad credentials.Any idea? I am new ...
0
votes
1answer
13 views

MultipartFile Upload : 415 Unsupported MediaType

I want to upload the file with spring boot and vue. But, I have an error '415 : Unsupported MediaType'. This is my spring boot controller. @PostMapping(consumes = {MediaType.MULTIPART_FORM_DATA_VALUE},...
0
votes
0answers
10 views

Realtime flutter chat application with springboot and MySql database

I have to develop a Real-time chat application with spring-boot and Mysql. This application is a flutter mobile application. I use spring-boot for my backend and MySQL as my database. Is there any way ...
0
votes
0answers
9 views

Java Spring with Thymeleaf get Environment property with a variable as parameter

I am using Spring Boot with Thymeleaf. In my controller, I have: response.setStatusLabel("label.order-intransit"); In my HTML, I have: <span th:text="${@environment.getProperty('${...
-1
votes
0answers
10 views

How tp make my Spring boot dependency like actuator

If I want to use my own own spring boot project as a dependency to other spring boot projects. But without component scan my dependency rest end points are not exposed . How to expose my dependency ...
0
votes
0answers
14 views

java.lang.ClassNotFoundException: org.apache.jsp.index_jsp Error while deploying the spring boot Application

I'm trying to deploy my spring boot application in digital ocean ubuntu VM and I created a .war file and uploaded using Tomcat Web Application Manager. But I am getting an error as, FAIL - ...
0
votes
0answers
16 views

MySQL 5.7 Spring JPA transaction management not worknig

MySQL version: 5.7.35 MySQL JDBC driver in use: mysql-connector-java-8.0.25.jar:8.0.25 Spring Boot: 2.5.0 I have two database tables: create table first ( id bigint auto_increment primary ...
0
votes
0answers
13 views

Springboot Performance Test Injecting Inner beans [closed]

I have an application that persists data to a db. I need to run some performance tests which would persist 1000s of records to the db. So I want to write SpringBootTests with real repository classes ...
0
votes
1answer
10 views

How do change streams work in mongo across multiple instances?

Let's assume I have two data centers each with 3 instances running the same code connected to a single MongoDB and separate Redis databases. Redis A <----> Data Center A ...
0
votes
0answers
14 views

Spring batch / How to pass a multipart file as a resource

I want to pass a csv file as a resource in a spring batch and then insert it into the database, without having to store the file locally. Controler @RestController @Slf4j public class Controller { ...
0
votes
0answers
14 views

Spring boot in docker doesn't read bootstrap.yml file

I'm packing my spring boot app with spring-boot-maven-plugin. My pom.xml looks like that: <plugin> <groupId>org.springframework.boot</groupId> ...
0
votes
0answers
14 views

Send data object using key

I want to create something like quick switch to send Java object based on Key. I tried this: private MessageProcessor defaultProcessor; private Map<String, MessageProcessor> processors; ...
0
votes
0answers
30 views

Preventing Brute Force Attacks in Java

In my Java (Spring Boot) app, I want to implement a prevention from brute force attacks based on the given conditions: I implemented Google reCaptcha and currently it is used (I do not need also this ...
0
votes
0answers
8 views

Spring boot angular unreaded notifications

Hi I have spring boot and angular app. I have notification table which contains seen flag.. I have working websocket, which ich sending notifications to user. Currently everytime user recieves ...
0
votes
0answers
8 views

Download a file with springboot resttemplate

I using this code to download a file: HttpHeaders httpHeaders = recuperaHeaders(); File file = restTemplate.execute(url, HttpMethod.GET, null, clientHttpResponse -> { ...
0
votes
0answers
19 views

spring boot reactor not logging request id contextually

I am trying to capture request id and decorate every log message with it. Using log4j2 and webflux. return Mono.fromCompletionStage(..removed..) .build())) .map(...
-1
votes
2answers
22 views

Hibernate insert doesn't work with custom native query

In a spring boot project and database SQL Server, I'm doing some inserts where I need to return the id of the record I have a Entity with few fields: public class PackGroupEntity{ @Id @...
0
votes
0answers
14 views

How to make call with the delete method with a requestbody

I have the following method: @Test public void correctHandleOrderDelete() throws JsonProcessingException { String uri = getUri(); whenHttp(server) .match(delete(uri)) ...
1
vote
2answers
61 views

Java Spring Boot @Autowired values are null

When I try to print the variable that I have autowired, it prints "null" instead of the value I set it to, "Example." I can't quite figure out what I'm missing In my AppConfig ...
0
votes
0answers
10 views

SQS queue listener (Springboot)

How to control request with SQS. Suppose 4 request submitted in a same time in SQS, then only need to process one at a time. Once first is completes take second request from queue in process, and this ...
0
votes
0answers
10 views

How to search with optional data and list data in ElasticsearchRepository?

I am using spring-data-elasticsearch and I have a class as follows, @Document(indexName = "sample") class Sample { private String id; private String b_ref; private String r_ref; ...
0
votes
0answers
7 views

Rollback inner transaction affects the outer transaction in hibernate spring

@Service @Transactional public class Service1 { @Autowired Service2 service2; public void method1(){ //read some records from db List<Record> recordList = ...
0
votes
0answers
22 views

How to get number of Row updated in Postgres

I am new to postgres SQL transaction and spring boot jdbctemplate, I want to get the number of rows updated by running the below query: set statement_timeout to 0; set lock_timeout to 120000; begin ...
0
votes
0answers
5 views

Disconnect client from Spring websocket stomp server

Title says it all. I have stumbled on this SO answer. But this doesn't work with the current version of Spring Boot (2.5.3). Does anyone know the best way to close a client connection from the server?
0
votes
1answer
35 views

Why can I not instantiate a new Class object?

So this is a real head-scratcher: I've got some code that tests for certain conditions to be met; and when met creates a new Object then sets some values for that Object then adds that Object to a ...
0
votes
1answer
12 views

Spring Boot Batch - Read Data from Database but don't want to write meta-data to database

im developing a Spring Boot Batch App that will read data from a database and write it to a csv file. when i tried to run it, it gets me an error : Caused by: org.springframework.jdbc....
0
votes
0answers
7 views

Thymeleaf. Server does not see templates directory, how can I point to it if I packaged app to jar

I have a java Spring Boot application that uses Thymeleaf and Model in my Controller. Also I have templates directory in my resources where all .html pages are located. My Controller @Controller @...
1
vote
1answer
29 views

Execute multiple lines in orElseThrow

I have the following code block that throws exception if the user is not found. On the other hand, in addition to throwing exception, I also want to call a method when user is not found. So, can I ...
0
votes
0answers
7 views

How to insert delay in displaying an HTML element in thymeleaf template

I have scenario where in I have below loop in thymeleaf template. I want to insert delay in displaying each of those elements, say 1 second delay. How can I achieve this in thymeleaf template with ...
0
votes
0answers
8 views

Saving all fetched data into local database via Spring Rest Template

@Override public Worklogs getAllWorklogs() { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.set("Authorization", "...
0
votes
0answers
18 views

How to correctly set MySql password? java.sql.SQLException: Access denied for user 'root'@'localhost'

I have the following problem trying to execute a Spring Boot application that must connect to a MySql database. I have this application.properties file: spring.datasource.platform=mysql spring....
0
votes
0answers
7 views

spring boot serving static pictures from file dir

So im making a spring boot project and i want users to be able to upload pictures into a directory relative to the project folder of my app. I am able to save the pictures in "/diplomna/uploads&...
0
votes
0answers
11 views

Spring Boot, POST multipart string without file button on swagger

To upload a huge string as stream to java web service, with Jersey, it can be done with the following code: @POST @Consumes({ MediaType.MULTIPART_FORM_DATA }) @Produces({ MediaType.APPLICATION_JSON }) ...
0
votes
0answers
6 views

Send request to evict in memory cache to all other Spring Boot nodes in Eureka

In 2 words, we need somehow to sync caches on all nodes connected to EUREKA. Some details: We have scalable cluster of Spring boot services. Each service has connection to DB to get configs from. We, ...
0
votes
0answers
6 views

How to remove the System generate password in spring security while using inMemoryUserDetails for authentication?

i am working on spring boot security from scratch,so while checking i am seeing this weird behaviour. i am configuring inMemoryAuthentication details like below in the AuthenticationManagerBuilder and ...
0
votes
0answers
17 views

Selenium multiple errors: no such element: Unable to locate element: {“method”:“css selector”,“selector”:“#name”}

I am trying to test my website using Selenium and am often experiencing an network error, but when I sync my time it allows me to connect as usual. Then when I can actually run the test I get the ...
0
votes
0answers
25 views

Spring Security 5 - Setup AuthenticationManagerResolver for JWT and OpaqueTokens fails

I am trying to apply Spring Documentation to setup an OAuth 2.0 Resource Server using Spring Security 5.5.1 : https://docs.spring.io/spring-security/site/docs/current/reference/html5/#...
0
votes
0answers
14 views

Validating a list of nested Object with spring boot - @Valid not working

public class ProgramDetailsDTO { @NotBlank(message = ResponseConstants.PROGRAM_NAME_INVALID) @Pattern(regexp = ValidationConstants.PROGRAM_NAME_REGEX, message = ResponseConstants....
0
votes
0answers
16 views

Circular dependency only if config file is in another dependency

I would like to create an interceptor that needs a feignClient as dependency. I created a configuration class @EnableWebMvc @Configuration public class MvcConfiguration implements WebMvcConfigurer { ...
1
vote
1answer
25 views

@ConditionalOnBean(KafkaTemplate.class) crashes entire application

I have a Spring boot application that consumes data from Kafka topic and send email notifications with a data received from Kafka, @Bean public EmailService emailService() { return new ...
0
votes
1answer
19 views

Spring Batch ItemReader skips the first record on the second page

I have this ItemReader: @Bean public JpaPagingItemReader<GWBillingDetails> itemReaderUpdPCJPA() { JpaPagingItemReader<GWBillingDetails> reader = new JpaPagingItemReader(); ...
0
votes
0answers
15 views

Spring RestTemplate GET and save all data in local db that returns all saved data from local db

Is there a way to implement a service that fetchs all data from an API via RestTemplate GET saves all data into local database returns all data from local database in Spring Boot? If yes, How? any ...
1
vote
0answers
14 views

Why Spring mail does not recognize my Gmail account?

In my SpringBoot application i'm using Spring mail to send emails from a Gmail account (i connected through an app password). It was working fine, but after a time (about a week), it stopped working ...
0
votes
0answers
22 views

springboot jpa entity relation mapping

there is 4 table BigProject SmallProject Issue Member One BigProject has multiple SmallProject. SmallProject has multiple Issue. One Member can belong to only one BigProject. One Member can belong ...
0
votes
0answers
14 views

Whitelabel Error Page when openapi is removed

I am migrating an application from swagger2.0 to 3.0. When I comment open API I am getting Whitelabel Error Page. Wanted to understand what is the relationship between these. // implementation ('...
0
votes
0answers
11 views

javax.ejb.Remote not able to resolve in spring boot

Recently I shifted to a development project, in this we have very old code, we have to update the spring to spring boot an error is showing in import javax.ejb.*; showing that not able to resolve can ...
0
votes
0answers
11 views

How to logout with Webflux

When I login(on loginpage.html) the cookie the jwt-token is placed. In my controller: @PostMapping("/login") public Mono<String> login(User user, ServerWebExchange swe) { ...
0
votes
0answers
4 views

Elastic Search Template depricated in spring boot 2.5.9

@Component public class SearchQueryBuilder { @Autowired ElasticsearchRestTemplate elasticsearchRestTemplate; public List<Customer> getAll(String text) { QueryBuilder query = QueryBuilders....
0
votes
1answer
26 views

getting online users using JWT tokens

I want to create a service that returns a list of online users. The user logs on using JWT tokens -- but I am unsure how to get online users -- or/and return a list of users but indicate if they are ...

1
2 3 4 5
2177