610 questions
-2
votes
1
answer
2k
views
how to get csrf token into spring controller?
I am trying to return CSRF token from a REST controller with spring 4 with xml based configuration.
I have tried this:
@RestController
public class Somecontroller{
@RequestMapping("/csrf")
public ...
0
votes
0
answers
61
views
How to change dynamically the connexion login and password?
In the configuration class I set the connexion caracteristics :
@Configuration
@ComponentScan("com.ambre.pta")
@EnableTransactionManagement
@PropertySources({
@PropertySource("classpath:fr/global....
7
votes
0
answers
773
views
How to consume empty collection without HAL response structure in spring-data-rest
I am using spring-data-rest in my application. I configured repositoryRest using configureRepositoryRestConfiguration
I added the following two lines in this configuration
config.exposeIdsFor(Person....
1
vote
0
answers
169
views
Not able to access data produced by server API in Javascript but works on Postman
This is a strange problem and I tried to debug it through the day with no effect. I have written a REST API in Spring 4 and it seems to be working fine. I've tested the links with postman, they work ...
0
votes
0
answers
2k
views
org.springframework.beans.MutablePropertyValues.add(Ljava/lang/String;Ljava/lang/Object;)Lorg/springframework/beans/MutablePropertyValues
I am new to Spring, I am currently using Spring 4
Once the war is deployed into JCS-SaaS (cloud) I am getting belows error :
[2016-11-08T12:50:06.686+00:00] [INCIDENT_ERROR] 1 [incident 22
...
0
votes
0
answers
669
views
In Spring 4.3.3, only POST requests do not work
Only POST requests are not working.
It works normally in Spring version 3.2.0 RELEASE but not in Spring version 4.3.3 RELEASE.
I don't know why this it does not work.
Please help me..
JSP
<...
1
vote
1
answer
1k
views
How to resolve ambiguity in Spring constructor injection
I am trying to learn constructor injection using Spring 4.3.
I am having class structure is stated below.
@Component
public class Student {
private Address address;
private City city;
...
0
votes
3
answers
7k
views
How to know that a session is expired?
I set values to the session object in the method of a controller after success of login :
@RequestMapping(value = "/", method = RequestMethod.POST)
public ModelAndView processLogin(Model ...
5
votes
1
answer
5k
views
How to pass data to an exceptionhandler?
I found a tuto to manage exceptions from this site. So here is my handler :
@Controller
@RequestMapping("/adminrole")
public class AdminRole {
...
@ExceptionHandler({org.hibernate....
3
votes
0
answers
1k
views
how to get List of generic type from spring hateoas traverson
Consider my following code. I am trying to get list of objects based on the generic responseType using spring-hateoas Traverson class
public <T> ArrayList<T> getList(String path, ...
0
votes
0
answers
1k
views
Migrating spring 3 to spring 4
I'm trying to upgrade a legacy application developed in spring 3.2.x and java 7, to spring 4.0.3 and java 8.
I'm getting org.springframework.core.NestedIOException: ASM ClassReader failed to parse ...
0
votes
2
answers
673
views
org.hibernate.MappingException: Unknown entity hibernate4 spring4
I am getting the exception
org.hibernate.MappingException: Unknown entity com.pro.entity.User
I have seen similar posts but almost all of them provides solution to change @Entity annotation to javax....
1
vote
0
answers
7k
views
IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context
Please find the error below:
Java version : 1.8.0_101
2016-10-19 17:17:56 DEBUG StandardServletEnvironment:110 - Adding [servletConfigInitParams] PropertySource with lowest search precedence
2016-...
0
votes
2
answers
562
views
Spring-4 - Refactoring use of instanceof for calling appropriate method
I have below set of interfaces and classes.
Note the doSomething method. It has to check for the instance of the object before calling the interface method on it. I would like to avoid that, as it ...
0
votes
1
answer
77
views
No mapping found for HTTP request with URI [/test_svn/] in DispatcherServlet with name 'appServlet'
I created a project with Spring Tool Suite from subclipse. Here are files :
pom.xml :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="...
0
votes
1
answer
1k
views
Spring + Hibernate migration - currentSession() method throwing exception
I have migrated Spring from 3.1 to 4.1.3 and Hibernate 3.2 to 4.3.9
As part of migration I have modified below import and code
old import
import org.springframework.orm.hibernate3.support....
2
votes
1
answer
4k
views
passing RUN_ARGS for spring boot application running as service in linux
I have followed instructions from spring-boot documentation and successfully deployed spring-boot as service in centos.
All the following commands work
sudo /etc/init.d/myapp start
sudo /etc/init.d/...
0
votes
1
answer
64
views
How to create a project from another one stored in SVN?
I created a Spring legacy project from Spring Tool Suite, it is a Spring-MVC project. I deposited my project into a Linux Ubuntu server where there is SVN installed. Now my coworker wants to work on ...
1
vote
0
answers
1k
views
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/util/ExpressionEvaluationUtils
I just upgraded a Spring application from version 3.2 to a 4.2.5 and tomcat8 with java8 build . application build and server startup was went fine, but when i hit the application URL i'm getting the ...
3
votes
1
answer
2k
views
How to get all the requestmapping of all controllers?
I created many controllers having each their requestmapping specified in order for them to be identified in the app :
package com.ambre.hib.controller;
@Controller
@RequestMapping("/")
public class ...
1
vote
0
answers
145
views
SpringMVC @RestController run on a machine but not on the other same configuration machine
I am experiencing a weird error. My application is working on one machine but the same URL throws 404 on a different machine having same configuration. The technology suit I am using
Spring4.1.1.6
...
0
votes
1
answer
2k
views
What is the java type equivalent for the oracle datatype raw?
In my oracle database table there is a column of datatype raw. Now in my spring bean class I want to map this table. So what java datatype is the equivalent of the oracle raw datatype ?
1
vote
1
answer
4k
views
Logging incoming and outgoing HTTP REST request/response in Spring/Tomcat
I have a Spring REST service and sometimes when I request the REST service I get a HTTP 401. I am looking to investigate this issue, this is intermittent and does not happen at all times. (It is the ...
1
vote
1
answer
11k
views
Spring Security java.lang.IllegalArgumentException: Failed to evaluate expression 'ROLE_ADMIN' [duplicate]
I'm working with the book "Amuthan G - Spring MVC Beginner's Guide". Currently I'm trying to implement security using the next security-context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<...
2
votes
1
answer
130
views
Spring 4 Security configuration runs but not active
I am quite new to Spring, so sorry if my question sounds silly.
I am trying to add basic HTTP Auth to my Spring based REST API.
I have been following quite a few tutorials and reference ...
6
votes
2
answers
3k
views
Cannot Connect Spring Boot Application to IBM Informix Database
I cannot connect my spring boot application to IBM Informix database. I have added the informix data source in application.yml file.
I am using spring 4.
I get the following error.
no writeable ...
0
votes
2
answers
3k
views
How to use a java class as a entity and also as a model
I have a entity class "classA" and a model class "ClassA1". ClassA is used to store the values in mysql database from server side and ClassA1 is used to convert a API response string into object which ...
1
vote
0
answers
35
views
whilie calling getBean( with Impl class) then getting below exception?
Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.dav.spring.domain.HelloWorldImpl] is defined
at org.springframework....
0
votes
2
answers
138
views
spring 4 security jars are missing for offline download
while working on spring mvc 4, how to find the jar for offline project like the jar Spring Security Config,spring-security-web for spring 4 ... etc as thet are not available with default package of ...
0
votes
1
answer
31
views
log4j is configured to be web but there is no output
I modified the log4j.xml :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
<log4j:configuration debug="true" ...
0
votes
1
answer
22
views
Collection object of an entity fetches value after session close
I have an entity having OneToMany relationship. After fetching the parent entity by below way:
User has many educational degrees.
@Transactional(propagation = Propagation.REQUIRED)
-----------at ...
14
votes
2
answers
12k
views
Using ehcache 3 with Spring Annotations (not using Spring Boot)
I'm trying to get Ehcache 3 working with Spring 4 without using Spring boot.
Here is a working example out there which uses Spring Boot, but I'm working on an existing application which is not using ...
0
votes
2
answers
920
views
How to specify the controller name if two controllers have same RequestMapping path value?
There are 2 controllers having same @RequestMapping value :
package com.ambre.hib.controller;
@Controller
public class AppointmentsController {
@RequestMapping(value = "/new", method = ...
0
votes
1
answer
86
views
Cannot use expression in where clause
I want to implement a server-side filtering of DataTable. Here is the service method for retrieving the list :
@Override
@Transactional
public List<User> list(int start, int length, ...
0
votes
0
answers
68
views
Cannot use MatchMode with variable of type double
I am implementing server-side filtering of dataTable. In the service which implements the filtering I want to test if the search criteria is a number ; if so then I implement the filtering based on ...
2
votes
1
answer
5k
views
Cannot import org.apache.commons.lang3.math.NumberUtils
My IDE is Spring Tool Suite. I want to use the NumberUtils.isNumber function. STS does not know the class , and there is no suggestion of import in the error icon. My buildpath is using java-se 1.6 :
...
0
votes
1
answer
305
views
org.springframework.beans.factory.CannotLoadBeanClassException
I found a simple problem and ask for help.
There are the exception message:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory....
0
votes
2
answers
4k
views
How to provide a parameter value for an autowired variable?
I want to autowire a variable :
package com.ambre.hib.dao;
public interface LangDAO {
public String _getText();
}
package com.ambre.hib.dao;
import org.springframework.beans.factory....
8
votes
2
answers
22k
views
Swagger UI does not list any of the controller/end points though I am able to see the json under v2/api-docs endpoint
I am not able to get my Swagger UI to work with my project. Swagger UI comes up fine but it does not list any of my REST controllers.
I am using SPRING 4.2.6.RELEASE and Swagger 2.5.0 . My rest ...
2
votes
1
answer
2k
views
Ehcache concurrent modification exception using + Spring + Struts application
In my application the ehcache is configured as below.
AppDataRegion.java
//import statements.
public class AppDataRegion{
//Variable for region identifier.
private String appRegionId;
// ...
2
votes
1
answer
1k
views
spring security 3.x to 4.x migration issue
I am trying to migrate spring security 3.x to 4.x,
while doing so I had the following error
Aug 27, 2016 11:16:03 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception ...
-1
votes
3
answers
2k
views
Spring MVC: cannot find other html files
Why the link http://localhost:8080/demo00/user/ didn't work, saying 404, how to fix it?
My website project structure:
website structure
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" ...
1
vote
3
answers
6k
views
How to redirect page after ajax complete?
My ajax is performing successfully because it deletes the row from database :
@Controller
...
@ResponseBody
@RequestMapping(value = "/ajaxDeleteUser", method = RequestMethod.POST)
...
5
votes
2
answers
12k
views
How can I use properties from a configuration (properties/yml) file in my Spring Boot application?
how can I use external configurations within my Spring application?
package hello.example2.Container
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind....
0
votes
3
answers
14k
views
How to know the classpath?
I want to read properties file keys and I found that there is the classpath attribute to set in the @PropertySource annotation :
@Configuration
@PropertySources({
@PropertySource("classpath:...
0
votes
1
answer
2k
views
What is the equivalent of die() in Spring?
In PHP there is the die("some message"); to write output and stop the execution of the script. So is there an equivalent in Spring mvc ( in Controller and in the JSP ) ?
1
vote
1
answer
1k
views
Spring4 issue- Setter methods with Spring @Qualifier annotation not getting invoked
I have migrated my project from spring-3.1.2 and java-6 to Spring-4.1.6 and java-8. Setter methods with Spring @Qualifier annotation are not invoked after this migration resulting in null values for ...
234
votes
7
answers
250k
views
Difference between the annotations @GetMapping and @RequestMapping(method = RequestMethod.GET)
What's the difference between @GetMapping and @RequestMapping(method = RequestMethod.GET)?
I've seen in some Spring Reactive examples, that
@GetMapping was used instead of @RequestMapping.
0
votes
0
answers
174
views
Spring 4 and EJB3
I want to separate frontend and backend into two different JVMs. I know EJB3 is for that purpose. Nevertheless I have not found documentation and examples to implement it using Spring 4.
Could you ...
0
votes
0
answers
264
views
Exception: java.io.NotSerializableException: org.springframework.jdbc.datasource.DriverManagerDataSource
I created a spring project (Spring 4.0.2). I present the required files:
spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
...