Questions tagged [spring-mvc]

18931 questions
1

votes
0

answer
139

Views

Different thread handling for Flux.fromIterable as a controller method result

My environment: Spring Boot 2.0.1.RELEASE with webflux running on Servlet container over Tomcat. I have defined one controller with code below. package com.demo.controller; import com.demo.service.pojo.User; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind...
maveron
1

votes
2

answer
565

Views

Spring 2.0.0-RELEASE ConfigurationProperties binding does not work

This scenario was ok in 1.5.3.RELEASE. I have external property file external.yml it look like this app: datasources: - name: sourceOne driver: xxx url: some_url username: u1 password: p1 - name: sourceTwo driver: xxx url: some_url2 username: u2 password: p2 i have added @EnableConfigurationProperti...
zafirov
1

votes
1

answer
21

Views

Problems involved in Re-creating twitter using Spring Boot

Me Again A quick question regarding JpaRepository I am working on a mirror project of Twitter using Spring boot and Hibernate. I have finished creating most of Twitter's functions - posting, forwarding, commenting, etc. Now I am working to make this web app more user-friendly, particularly regarding...
Shelton
1

votes
1

answer
22

Views

Spring MVC using AJAX return page not found

I have create an endpoint to delete a record, yet when i use either POST or GET, i could not reach to that end point, it always said page not found ,i realized there is weird parameter was appended. example: http://localhost:8080/admin/panel/case/survey/delete/completion/form/0af9518a-8eea-4e69-94...
marwn Ameenn
1

votes
0

answer
76

Views

best practice to set the formatter of LocalTime to ISO

After searching and looking in spring source code, I found I can configure application-wide default LocalTime formatter (mainly for use in Request Parameters) in one of two ways (both by subclasses for WebMvcConfigurer: @Override public void addFormatters(FormatterRegistry registry) { registry.addFo...
1

votes
0

answer
54

Views

Show image depending on user reputation - Spring MVC - Thymeleaf

I want to show an image depending on the user reputation. I tested the image beforehand so I know the URL is correct. But i'm having some trouble with my switch case syntax: which gives me the following error: org.xml.sax.SAXParseException; lineNumber: 34; columnNumber: 61; The entity name must imme...
Audiosleef
1

votes
1

answer
26

Views

Bad request error while submitting a form in Spring 4

I'm getting a 400 bad request error while submitting my form. I'm using spring 4.0.6 version. I don't why this is happening. Please see the below error what I'm getting. Here is my JSP .head-color { background: rgb(243, 246, 234); color: #800000; text-align:center; } .date-width{ width:25% !im...
1

votes
1

answer
111

Views

Spring Boot doesn't render views properly

I've always build Spring MVC web application configuring them by myself until I've been told about this Spring Boot that helps you configuring/initialising your application. So I decided to give it a try and I created a new project using Spring Boot. I followed all the steps in order to make it wor...
1

votes
1

answer
778

Views

Tomcat Server Not Starting from Eclipse Oxygen in Mac

I added tomcat 8 and 9 both in my eclipse oxygen and tried to run Spring based Web Application on the tomcat server but its giving error in console: Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit In popup it gives the error: 'Server Tomcat...
bawlo
1

votes
0

answer
240

Views

saml authorization not working

I have to implement saml in my existing web-app. I was using spring security with custom authentication and role based authorization. But facing difficulty to implement the authorization moving from spring security to saml based. I have 2 context xml. Below are my context xml files. spring-security-...
codenow
1

votes
1

answer
86

Views

How to implement google reCaptcha v2 in spring framework

My reCaptcha in the registration screen is not working anymore since the google has been shutdown reCaptcha v1 . Can somebody tell me how to implement reCaptcha v2 in my spring application. Does anyone know any documentation link?
1

votes
0

answer
47

Views

spring + springMVC+hibernate create dynamic tables at runtime

I have a requirement in my web application that can let users enter tables's name, attributes and datatypes to create tables. But as I know, the tables should be defined beforehand in hibernate. Is there any way of doing so? Thanks in advance, Tianyi
Tianyi111
1

votes
1

answer
221

Views

How to test if a REST endpoint returns a number in Spring Boot?

I have a simple controller that requests a number from some random REST service and wraps it in a JSON object. These numbers can either be integers or floating point numbers. Thus the consumers of my REST endpoint should expect a floating point value. This is my controller: import static org.springf...
stevecross
1

votes
0

answer
171

Views

Tomcat-embed-jasper added but jsp pages Whitelabel 404 Error

When I added tomcat-embed-jasper dependency my project got red color means ERROR in Project. Then, when I run my Project, got Error: Could not find or load main class Dependency are: org.apache.tomcat.embed tomcat-embed-jasper application.properties are: spring.mvc.view.prefix = /WEB-INF/views/ spr...
Gana
1

votes
1

answer
547

Views

Error creating dataSource bean

The dataSource is defined in this class and I am using the same bean in springSecurityConfig.java class but it is giving me error : No qualifying bean of type 'javax.sql.DataSource' available ShoppingServletConfig.java @Configuration @EnableWebMvc @EnableTransactionManagement @ComponentScan(basePac...
Bishwa Karki
1

votes
1

answer
237

Views

Dynamic Serve static-locations in spring boot

I have a spring boot application which contains web application build with Polymer. Polymer web application builds two version one with ES5 And one ES6. It mean i have two separate web application builds. Now on based of user agent like for Chrome & firefox i want to serve ES6 version and for IE11 I...
Junaid Akhtar
1

votes
0

answer
1.7k

Views

There is no PasswordEncoder mapped for the id “null” in DelegatingPasswordEncoder

I am New on Spring Security.using Spring 4.3 and Spring Security 5.0 .Everything Run .the login page also came .if you given Wrong Password it tells Your login attempt was not successful, try again.Fine But Right Password give it raised Exception my Spring_Security . XML is my Web.xml contextConfi...
Gana
1

votes
0

answer
41

Views

controller is not getting called from jquery/ajax for creation of dynamic dropdown

This is my controller: i am trying to make dynamic dropdown list.In my code i am trying to call my controller method but it is not getting called. @Controller @RequestMapping('/data') public class DataController { @Autowired private DataServiceInterface service; public DataController() { System.out....
Danzen_mstr
1

votes
1

answer
101

Views

Using PointCut expression inside xml files with multiple combination

The project that I have been assigned to uses xml files to create aop configs. Part1: The aop configured in my xml file is: Can someone explain what is being done here in there. I have an idea about what point cut does but here I cant figure out what those '&' means and the entire stuff altogethe...
DockYard
1

votes
1

answer
2k

Views

java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.clearCache()V

I am getting this run-time error: java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.clearCache()V And part of stack trace: Caused By: java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.clearCache()V at org.springframework.context.support.A...
Kingamere
1

votes
0

answer
302

Views

best way to convert MockHttpServletResponse to ResponseEntity

just wondering what is the simpler/best way to convert MockHttpServletResponse to ResponseEntity the background is I have my tests currently using TestRestTemplate and plan to migrate them to use MockMvc the situation is that MockMvc.perform(...).getResponse() returns a MockHttpServletResponse and...
Miguel Costa
1

votes
1

answer
1.2k

Views

Add a Custom message for the Unique Constraints in hibernate

@Entity @Table(name='users',uniqueConstraints = {@UniqueConstraint(columnNames = {'email'})}) public class User implements Serializable { @Column(unique = true,name = 'email') @NotNull(message = '{NotNull.email}') @Email(message = '{Pattern.email}') @Size(min=10, max=50) private String email; public...
Semantic
1

votes
3

answer
104

Views

what is the best way to set headers in url in Java

I have following bean public Sample{ @Value private String accoutName; @Value private String url; private String password; // @PostConstruct public void retrievePassword(){ String serviceURL = url+ '?accountName=' //I have few more paramaters URL obj = new URL(serviceURL); HttpsURLConnection connect...
tech_questions
1

votes
1

answer
183

Views

Java - Hibernate : Generate sequence column based on another field

Need to add a field to the database which will record a sequence number related to that (foreign) id. Example table data (current): ID ACCOUNT some_other_stuff 1 1 ... 2 1 ... 3 1 ... 4 2 ... 5 2 ... 6 1...
sangv
1

votes
0

answer
55

Views

Mode mappings conflict between method and type level

I have this problem with my controller. The log says:'Mode mapping conflict between method and type level: [/fotoProfiloUtente.do] versus [VIEW]. I can't move the method to another controller, i've to use this one. This problem is driving me crazy, i've tried to study Spring MVC or searching on stac...
NicholasASR
1

votes
0

answer
67

Views

java saml pac4j mvc callback settings

Scenario: implementing pac4j-saml into our existing Spring Web MVC application. Using spring-webmvc-pac4j-demo app as a template. Have only one idp (Akamai). Requested to the idp that our SSO URL be http://localhost:8081/Maintenance/saml/sso. Requested to the idp that our Audience URL be http://loca...
Gilbert
1

votes
1

answer
1.2k

Views

multipart file upload check mime type in java

I am using mimeutil for checking the mimetype of a file. And only allowing csv and json files. But getting this mimetype for a json file 'application/x-ipynb+json' mime type which is nowhere found. Any help will be appreciated to get the exact mime type of a file if also renamed a exe file to json w...
codenow
1

votes
0

answer
19

Views

Spring Framework: Getting wrong object of processFormSubmission() due to multiple tab in browser

The problem of getting a wrong object is due to multiple tab of browser with this scenario: Tab one contains TestBean data. Create a new tab and fill up form with different TestBean data (Same page with same controller but different data). The first tab submits the form containing TestBean. Expected...
Jayvee Villa
1

votes
0

answer
212

Views

Update of @ElementCollection using JpaRepository

In a spring-boot webapp, i look for the update of only the @ElementCollection of an entity using JpaRepository given the member entity public class Member implements Serializable { private static final long serialVersionUID = 1L; ... @ElementCollection @CollectionTable(name = 'address', joinColumns...
alveomaster
1

votes
0

answer
71

Views

Getting Response to preflight request doesn't pass access control check Error - Spring Security +Oauth2 Rest Api

I'm very new to spring security concepts and also i have implemented oauth2 token based security using spring security. My Spring Framework versions are: spring framework-4.3.6.RELEASE spring security.version - 4.1.1.RELEASE spring security oauth2.version - 2.0.10.RELEASE Here What my problem is by...
Rama
1

votes
3

answer
1k

Views

springboot how to load properties from custom yml

I have a property bean (example): @Data public class MyProperty { private String name; private String address; } and I have a custom yml file in classpath named: my_property.yml my.property: name: testName address: testAddress How to load this file to my property bean? Not using @PropertyResource, b...
Jarvis
1

votes
1

answer
232

Views

Spring Dependency Injection by Constructor - Error creating bean, caused by: java.lang.IncompatibleClassChangeError

I just started to learn Spring framework. I was learning about Spring Dependency Injection by Constructor and came across this error when I tried to run the code. Please help me resolve this error and explain what makes this error occure. Thank you. Here is my code: ActiveMQMessage.java package com....
1

votes
1

answer
52

Views

Can GroovyTemplate, as a view technology of SpringMVC, create JSON?

I want to serialize my java data classes to JSON. To be honest, I posted a relevant question few days ago, however I haven't got my answer so far. At the moment, all answers suggest the Jackson's annotations. But I prefer not to get the classes involved directly and I think it's better that delegat...
vahidreza
1

votes
1

answer
337

Views

spingfox-swagger2 description in @Tag not honored

I am using the following version of springfox-swagger2 libraries in my Spring MVC project: io.springfox springfox-swagger2 2.8.0 io.springfox springfox-swagger-ui 2.8.0 And I would like to add description to my REST Controller using the following according swagger documentation: @RestController @Req...
user1563721
1

votes
1

answer
313

Views

How to add directory and subdirectories in static location in spring boot

I want to use resources from static directory and this directory may have another subdirectories. In spring boot application.properties file I am using below key to refer outside directory:C:/custResources/. I am able to refer resources from this directory but not from the subdirectoriese e.g. C:/...
Harshal
1

votes
2

answer
166

Views

How to inject dependency in Servlet in Spring MVC 4?

At present in my spring mvc based application i am implementing Servlets as well (this is a healthcheck servlet). I am trying to inject dependency of a class in this servlet using @Autowire annotation but this class is not instantiating. Please consider the below code. @WebServlet(name = 'myServlet'...
RockingDev
1

votes
1

answer
148

Views

Does Spring 5 Webflux has its own way of implementing SNS + SQS?

Does Spring 5 Webflux has its own way of implementing SNS + SQS? We are using Spring 5 Webflux to implement a microservice and would like to know if it provides its own way of SNS and SQS implementation. I googled but nothing came up specific to Spring 5 Webflux, so would like to confirm before doin...
Maria
1

votes
0

answer
38

Views

Maven Version Affects Spring MVC Deployment

We have an application using Spring MVC. We recently changed our build process to use Maven 3.0.5 instead of Maven 3.2.3 (there is not a relevant reason for this) and started experiencing exceptions deploying into WebLogic. org.springframework.beans.factory.BeanCreationException: Error creating bea...
Kevin Seymour
1

votes
1

answer
40

Views

MongoDB - How to declare object variable in jstl

I'm using MongoDB, My object is like this { 'id' : '1', 'Name' : 'jack', 'Date' : '22-03-2018', 'Time' : '123412', 'tmax_volumes' : { 'type1' : '392.7cm', 'type2' : '83.1cm', 'type3' : '24.1cm', 'type4' : '15.6cm' } } Now want to print tmax_volumes in my jstl page. In my jstl page using ${CO...
Ashok Charu
1

votes
1

answer
67

Views

Spring mvc filter doesn't take effect

I'm learning SpringMVC. The version I use is 4.2.5.RELEASE. The filter I configure in web.xml doesn't seem to work Server: Tomcat 7 Problem : When I use the GET method to pass in Chinese parameters, even if I configure the filter for UTF-8 encoding conversion, but the string I get is still garbled...
Gz Ke

View additional questions