615 questions
2
votes
2
answers
343
views
Migration Spring v2 to Spring v4 for org.springframework.cloud.stream.annotation
Introduction
I'm currently using EnableBinding , StreamListener from Spring v2: https://www.javadoc.io/doc/org.springframework.cloud/spring-cloud-stream/2.0.0.RELEASE/org/springframework/cloud/stream/...
1
vote
0
answers
174
views
How do you get property placeholders from one .properties resolved from another .properties through jasypt?
I have one application.properties file located elsewhere on disk which holds the password:
# c:/tmp/application.properties
some.encrypted.string=ENC(KB7EvxzOXglSbOrr8rqiyjwJZGpuQgyGfg5hHJgM/...
0
votes
0
answers
1k
views
Spring: The DispatcherServlet configuration needs to include a HandlerAdapter that supports this handler
we are trying to upgrade spring from 4.x to 5.3.x
this is the dispatcher-servlet.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www....
0
votes
1
answer
49
views
Spring security for non-Springboot app is not working
I was trying enable basic authentication for my endpoints in Spring 4. But it does not seem to do anything.
Any idea?
If I put a breakpoint, I can only see the configure method is called when the ...
0
votes
1
answer
394
views
Struts 2.5 Junit test setup with spring integration
struts version: 2.5.25
spring version: 4.3.26
Using: struts2-rest-plugin, struts2-spring-plugin, JUnit 4
I am looking for assistance in correcting my unit test configuration which is currently ...
0
votes
1
answer
443
views
Spring4 MVC keep session alive forever
I have a scenario where session is getting expired after some time of inactivity, But i need to keep Spring 4 MVC keep session alive forever.
Below is my Spring Initializer class,
'''public class ...
3
votes
5
answers
5k
views
Spring @Conditional based on a value in database table
Condition evaluation depends on a value provided in data base table
@Component
public class XYZCondition implements Condition{
@Override
public boolean matches(ConditionContext context, ...
3
votes
1
answer
6k
views
springdoc-openapi + Spring 4 Compatibility
I have an existing Spring 4 API and have successfully integrated springdoc-openapi to generate the OpenAPI 3 spec in JSON/YAML and also display the Swagger UI using springdoc-openapi 1.2.29 and Spring ...
2
votes
0
answers
427
views
aws sqs starts up with an NoSuchMethodError error
I am using spring 4.1.x, to create a producer to put messages into AWS SQS.
I created a configuration class for QueueMessagingTemplate. I get the below error during application start up. There seems ...
0
votes
1
answer
462
views
Spring 4 Session Cookie change field
I'm using Spring 4 and I create a Session using request.getSession()
I've observed that a SESSION cookie is created. The Response header contains as follows:
Set-Cookie: SESSION=...
0
votes
0
answers
351
views
Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file
getting ths exception, following is dispatcher-servlet.xml and HelloController.java
error.log
INFO: Initializing Spring FrameworkServlet 'dispatcher'
[INFO] FrameworkServlet 'dispatcher': ...
1
vote
0
answers
284
views
spring mvc 4: parse String to java.time.LocalDate using property format annotation
In a DTO, I can get a date string converted to a java.util.Date, using the com.fasterxml.jackson.annotation.JsonFormat annotation:
class myDTO {
@JsonFormat(pattern="MM/dd/yyyy")
private ...
0
votes
1
answer
1k
views
Facing deprecated issue after migrating iBatis to MyBatis into spring 4
When i migrate spring 3 to spring 4, iBatis is no longer support for spring 4. After google, i have added dependency 'mybatis-2-spring' into pox.xml but extended class 'SqlMapClientDaoSupport' class ...
0
votes
1
answer
686
views
LocalContainerEntityManagerFactoryBean hibernate configuration bean is initialized in a loop
I have my hibernate entity manager factory declared in jpa.xml, hazecast configured in hazelcast.xml and I have domain model setup and I have corresponding componentContext.xml present in the domain ...
0
votes
1
answer
669
views
org.jboss.as.ejb3.component.EJBComponentUnavailableException: WFLYEJB0467: The request was rejected as the container is suspended
We are trying to deploy EAR(EJB3 component and web module) in Wildfly-17 server.
The EJB3 components are injected to controllers with the help of Spring dependency injection.
During the server ...
0
votes
1
answer
125
views
No suitable driver found for {mysql.url} driver already declared in jpa
I had already declared my driver in my jpa class and also the dependecy for the connector for mysql and have the define schema in my DB.
but when am crating the war then message showing in logs the ...
0
votes
1
answer
253
views
Spring MVC 4 static resources not loading to Thymeleaf
I'm trying to load static resources to thymeleaf html file. But resources aren't loaded.Does anyone knows what Am i doing wrong here....
I'm using Spring Java Config here. This is my Config class
@...
6
votes
1
answer
8k
views
How to return java8 Stream from jdbc result set [duplicate]
To make best use of the java8 stream and Spring4, I use the Stream API as follows on a JDBC resultSet that comes from Springs jsdbRestTemplate (code shortened and simplified):
public <T> T ...
3
votes
0
answers
205
views
Trying to configure spring-mvc to use <mvc:annotation-driven/> for @ControllerAdvice for GlobalExceptionHandeling in dispatcher-servlet.xml
I need to use @ControllerAdvice for Global Exception Handling in my
application. For that i done these changes in my dispatcher I am
getting Exception in configuring xmlns:mvc in dispatcher. :(
...
1
vote
0
answers
1k
views
Out Of Memory: GC overhead limit exceeded, after jboss upgraded from 6 to 7
We have a legacy application which is build using spring3 and java 7 and it was running on Jboss 6. Recently we have upgraded the jboss server from version 6 to version 7.1.3 with spring version from ...
1
vote
0
answers
254
views
byte[] keeps accumulating data while streaming and do not push just the current data
I am using java 8, Spring 4.3.x and Tomcat 7.
Below is my code for Streaming huge data from database in the form of chunks.
public ResponseEntity<StreamingResponseBody> streamRecords(...
4
votes
2
answers
5k
views
SEVERE: Async timeout for GET [ Streaming huge data Using Spring MVC 4.3.x, Java 8, Tomcat 7 ]
I am using Spring MVC 4.3.9.RELEASE, Java 8, Tomcat 7
My code is as below,
@Controller
@EnableWebMvc
public class StreamRecordsController {
@RequestMapping(value = "/streamrecords/{elementname}"...
0
votes
2
answers
2k
views
DI injecting a String bean as single element of a List<String> instead of the proper List<String> bean
I am learning Spring Framework and DI for the first time, and trying a little test app with Spring-boot 1.2.0 (project constraint due to Spring Framework version required to be 4.1.x), I made a ...
0
votes
1
answer
151
views
How hide exception while bean initializing
I'm creating some Spring service class. One method returns
com.mxgraph.view.mxGraph
that loads some resources bundle in static context, in particular for current locale, but there is no Russian ...
0
votes
0
answers
46
views
Spring bean management using @Autowired
I have a messaging call that will process my payload which starts from MyClass. In load test i see that the first payload is getting over written by the next. All my classes are spring managed by @...
0
votes
1
answer
14k
views
Difficulties In Migration from Spring 4 to Spring 5
Planning to Migrate Spring 4 project to Spring 5.
I browsed about spring 5 features and it has some interesting features like Webflux , Reactive Programming ... which may increase the performance of ...
0
votes
1
answer
816
views
**java.lang.OutOfMemoryError: Java heap space with Spring 4, Hibernate 4, My Sql connector 8.1 and tomcat 8.5** when using **My SQL 5.7.23*
Here is the exception Details : -
java.lang.OutOfMemoryError: Java heap space
at com.mysql.jdbc.Buffer.<init>(Buffer.java:57)
at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:2087)...
1
vote
1
answer
1k
views
Spring 4 AOP : Getting exception java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
i am trying to run a Spring AOP demo program using Spring Advice parameters. I am getting exception "java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut" while executing the ...
0
votes
1
answer
37
views
Need xml bean's java representation in Spring4
How can i represent the following code snippet in java, my project is using Spring4 and i need to convert the same. Any help would be much appreciated. Thanks in advance!
<bean id="jndiTemplate" ...
0
votes
1
answer
105
views
Make websocket (sockjs) work with spring4 running at GlassFish 3.1.2.2
I try to create websocket connection using sockjs on client and spring4 (with java config) on backend under GlassFish 3.1.2.2 but whatever I do it always fail with the following problem:
java.lang....
2
votes
1
answer
3k
views
Spring4 Jersey2 integration: Adding jersey-spring4 fails
I'm trying to integrate Spring 4 with Jersey 2.
However this exception is thrown and deployment on Glassfish 4.1.1 fails:
java.lang.AbstractMethodError:
org.glassfish.jersey.server.spring....
-2
votes
1
answer
676
views
NullPointerException while running JUnit
Getting NullPointerException while running a JUnit test. I have already mocked the ClientHttpResponse class. Not sure what else I am missing.
Error:
java.lang.NullPointerException
at org....
0
votes
0
answers
132
views
No response and no error returned from spring MVC for data size> 15 MB for a webservice API
I am not able to get response or error for a request which is supposed to return data of size > 15 MB .My application is deployed on localhost on Apache tomcat 8 server.I am able to get response up to ...
0
votes
0
answers
1k
views
Override Jackson-databind.ObjectMapper to accept BigDecimal as String during Serialize and Deserialize in Spring web 4.x
HashMap<String,String> containing decimal value and needs to considered as String during jackson Serialization. But we are getting error:
Error:
Caused by: java.lang.ClassCastException: ...
13
votes
2
answers
7k
views
How to inject a bean into a Spring Condition class?
I am defining conditions that I will check to dynamically load one of the two implementations of my service interface later.
@Component
public class IsPolicyEnabled implements Condition {
@...
0
votes
1
answer
77
views
Spring4 Security configuration
I'm using Spring4 with tomcat, my web.xml follow:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/classes/resources/beans.xml</...
0
votes
1
answer
53
views
trying to upgrade to Spring4 no xml configuration webapp
I'm trying to build a little hello world WebApp prototype with Spring 4 without any xml file configuration.
Than I use tomcat 7 and here is my pom:
<dependencies>
<dependency>
...
0
votes
1
answer
40
views
Spring4 Form Validation
I have a situation similar to the followa:
public class Shop {
@NotNull
String name;
@NotNull
String desc;
}
a button to show a form where I have to insert my user:
<form:form method="...
2
votes
2
answers
2k
views
Spring 4: run some initialization code before application context refresh
I am using Spring 4 (not Spring Boot) in the web application. I need to run some initialization code before any of the beans in the application context would be created. I tried to create ...
0
votes
0
answers
87
views
Getting access denied after a successfull authentication Spring Security with JDBC
After a successful authentication i get redirected to a access denied page.
WebSecurityContext
@Configuration
@EnableWebSecurity
public class WebSecurityContext extends WebSecurityConfigurerAdapter {...
0
votes
1
answer
615
views
Remove # hashtag from angular 1.5 url
I am trying to remove the hashtags from my Angularjs app's URLs using the locationProvider, and it works well until I refresh a page manually. When I am refreshing page my angularjs js and css file ...
0
votes
1
answer
1k
views
Why does my ResponseEntityExceptionHandler never get invoked?
I've got a simple @RestController. My ultimate goal is to be able to validate if an incoming @QueryParam String id is an UUID. That part works, but the exception being thrown by the ...
2
votes
1
answer
4k
views
How do I validate a @QueryParam?
I've got a simple REST resource which accepts a couple of query parameters. I'd like to validate one of these parameters, and came across ConstraintValidator for this purpose. The REST resource ...
0
votes
1
answer
867
views
@Conditional annotation causing BeanCreationException on nested beans
I am using Spring 4.x in which I am using @Conditional annotation to control the bean registration.
I have classes defined as given below,
@Controller
class SchoolController{
@Autowired
@...
1
vote
1
answer
210
views
Spring doesn't invoke Hibernate validator for method params validation
I would like to utilize Hibernate Validator annotations to validate my query parameters that are passed in a request to my service.
@GET
@Path("/")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(...
0
votes
0
answers
657
views
How to use Apache Commons PropertiesConfiguration as MessageSource in Spring?
I currently use ReloadableResourceBundleMessageSource from Spring as MessageSource in order to read internationalization messages.
The version of Spring I use is: 4.3.1.RELEASE
<bean id="...
0
votes
0
answers
396
views
How can I Run hibernate application with datasource in Intellij IDEA
Hibernate.cfg.xml
<property name="connection.datasource">java:/comp/env/jdbc/MyStatus-process</property>
web.xml
<resource-ref>
<description>DB Connection</...
0
votes
2
answers
3k
views
Spring 4 - Spring retry 1.2.1.RELEASE @Recover not working
I have created an adapterImpl class that will retry a method with an objA but if it throws an exception(hardcoded to throw) it will call recover method - which will again call the method with objB.
...
0
votes
0
answers
24
views
Auto-wiring generic dependency to a specific type
I have a class like this,
@Component
class GenericRepositoryModel<T>
{
//.,..
}
In my code, I have to use for a specific type,
@Controller
class WebController
{
@Autowired
private ...
2
votes
0
answers
443
views
Spring 4 rest to download URL resource as zip archive
I wanted to add a REST service to download a resource found by URL, and archived in ZIP format.
I use the following code to do that:
@GetMapping(value = "/downloadAsZip", produces = "application/zip"...