spring-mvc Questions

4

Solved

I used ModelAttribute to bind object in Spring web application. Once I notice that, in case an object has an boolean value A is true, its value will not be updated if we uncheck A's checkbox. For...
Foliated asked 4/1, 2012 at 8:7

1

Solved

I want to generate dynamic URL for my home page, how to get host URL in spring boot app. get Host url exp: https://localhost:8080/
Neusatz asked 13/3, 2023 at 13:11

5

Solved

I'm having trouble getting my tests annotated with @WebMvcTest to work. I have also configured spring-cloud-config-server and spring-cloud-starter, and all Test classes with this annotation seem to...
Acaricide asked 3/1, 2018 at 13:8

8

Solved

Logic I have to implement is logging all requests with body served to DB. So I decided to use: afterCompletion method of HandlerInterceptor. There are two parameters passed to this method HttpServ...
Actinouranium asked 17/1, 2014 at 18:38

3

Solved

Let's say I am writing Spring integration tests for a REST service A. This service in turn hits another REST service B and gets a list of URIs to hit on REST service C. It is kind of auto-discovery...
Abraham asked 8/6, 2015 at 15:49

2

Solved

Is it possible to chain locale resolvers? I'd like to take the locale value from: The session if maps with my accepted languages The cookie if maps with my accepted languages If both don't conta...
Prosciutto asked 24/8, 2012 at 10:8

10

I have a PagingandSorting Repository which has a method that accecpts a pageable object. I also have a controller that accepts a pageable object through the URL. My use case is that, if a user spe...
Lade asked 20/11, 2014 at 5:31

3

Solved

I am using a ISBNdB to get info about the books.The reponse type is application/octet-stream. A sample json response I get looks as follows { "index_searched" : "isbn", "data" : [ { "publisher_...
Forgiven asked 15/8, 2016 at 12:33

13

Solved

I'm using a Spring Boot app which runs my src/main/resources/config/application.yml file. When I run my test case by : @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classe...
Penchant asked 2/8, 2016 at 4:39

11

I would like to pass JVM arguments in the main spring boot class where we will be starting the spring boot application. Could you please share how to set JVM arguments in spring boot application? ...
Pathogenesis asked 10/11, 2015 at 16:46

6

Solved

I have a fragment of HTML page with one form and 2 button: <form action="#" data-th-action="@{/action/edit}" data-th-object="${model}" method="post"> <button type="submit" name="action" ...
Polyhydroxy asked 14/7, 2015 at 8:34

2

Solved

I am creating my controller and controller advice like this: Test class: @RunWith(SpringRunner.class) @SpringBootTest public class TestController { private MockMvc mockMvc; @Mock private MyS...
Fantastically asked 17/9, 2017 at 22:55

3

I'm trying to get the validation in spring-data-rest to work. From the documentation you only need to make a validator available, and I've got that to work, but when a validation constraint is succ...
Cindiecindra asked 26/2, 2014 at 1:17

2

Solved

I'm using a pretty vanilla spring-boot-starter-data-rest setup and enabled the PATCH method. All is working, but I have a security concern and wonder what's the recommended way of mitigating it. T...
Yovonnda asked 3/3, 2017 at 23:17

12

Here's my code, where I'm iterating through: <tr th:each="category : ${categories}"> <td th:text="${category.idCategory}"></td> <td th:text="${category.name}"></td>...
Octosyllable asked 17/11, 2015 at 9:59

7

Solved

This is meant to be an extensive canonical question & answer post for these types of questions. I'm trying to write a Spring MVC web application where users can add movie names to an in-memory...
Sclar asked 13/2, 2017 at 6:43

8

Solved

My entity id is generated, and it was working fine when I use DAO instead of Spring data JPA. @Id @Column(name = TABLE_COLUM_NAME_ID) @GeneratedValue private int id; Now I have starting to use S...
Ara asked 3/5, 2013 at 3:34

5

I am new to Spring security and developing spring REST API with OAuth2 authentication and authorization. Everything is working fine, but when I request Refresh token, than I get error which states ...

7

Solved

I would like to know what is the cleanest and best way to perform form validation of user inputs. I have seen some developers implement org.springframework.validation.Validator. A question about th...
Gallon asked 27/8, 2012 at 17:4

6

Solved

I don't understand what a callback method is and I have heard people use that term very loosely. In the Java world, what is a callback method? If someone could provide some example code of a Java c...
Wildawildcat asked 16/10, 2013 at 13:57

5

Solved

package ro.contabilitateexpert.AccountExpert.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.s...
Simulated asked 4/1, 2022 at 15:52

3

Solved

There seems to be weird behavior which I can't seem to pinpoint the reason for. When I access a particular url I get a 404 response while other urls that are handled by the same controller class wo...
Craniotomy asked 26/1, 2020 at 1:54

3

Solved

I setup my Spring Security application according to the reference document and after hours of troubleshooting I continue to get a null @AuthenticationPrincipal passed into my controller. The auth...
Rondelet asked 21/9, 2015 at 2:45

7

Solved

All the operations appear collapsed when I open it and I want it to be expanded by default. Is there any property I need to change to achieve it? This is my swagger Bean: @Configuration @EnableS...
Janiecejanifer asked 27/11, 2015 at 0:21

8

Solved

I found an example on how to set cors headers in spring-boot application. Since we have many origins, I need to add them. Is the following valid? @Configuration @EnableWebMvc public class WebConfi...
Knurled asked 21/9, 2016 at 17:42

© 2022 - 2024 — McMap. All rights reserved.