Questions tagged [spring-4]

Version 4.x of the Spring Framework

Use for general Spring related questions. This tag is for questions that are specific to versions 4.x only.

618 questions
15
votes
4 answers

ehcache configuration in Spring framework

I am trying to load some context from an RSS feed and pass it as a cache to the client using ehcache library in spring. here is my code : import org.springframework.cache.annotation.Cacheable; @Service public class GlossaryReaderService { …
user261002
  • 2,182
  • 10
  • 46
  • 73
14
votes
2 answers

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 Spring Boot. The problem is that…
Håvard Geithus
  • 5,544
  • 7
  • 36
  • 51
13
votes
1 answer

How to cancel AsyncRestTemplate HTTP request if they are taking too much time?

Since starting, I was always confuse of how to deal with InterruptedException and how to properly cancel the http request if they are taking too much time. I have a library in which I have provided two methods, sync and async for our customer. They…
john
  • 11,311
  • 40
  • 131
  • 251
12
votes
2 answers

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 { @Autowired private MyProperties props; …
WillMcavoy
  • 1,795
  • 4
  • 22
  • 34
12
votes
5 answers

Spring @RestController not returning plain text response

I'm experimenting with the new Spring 4.0 @RestController to return a simple text response from a controller: @RestController @RequestMapping(value = "/heartbeat") public class HeartbeatController { private static final Logger logger =…
Marcel Overdijk
  • 11,041
  • 17
  • 71
  • 110
12
votes
3 answers

Spring4 MVC Unit test does not compile

I have strange behaviour when trying to compile sources after Spring 3.2.5 → 4.0.0 version update. Faulty code snippet from ApplicationControllerTest.java (it is equivalent to code from documentation): import…
dma_k
  • 10,431
  • 16
  • 76
  • 128
11
votes
3 answers

java.lang.IllegalArgumentException: No PersistenceProvider specified in EntityManagerFactory configuration

i have created a maven project and added Spring4, Hibernate4 libs through pom.xml I m trying to link my web app with my database created in PostgreSql, but when i publish my project in apache tomcat 7 the following exception occurs :…
11
votes
1 answer

Spring 4 - Java Config, Tomcat, and Display Name

I'm using Spring 4.1.1 with pure Java Config (i.e., no web.xml at all). The AnnotationConfigWebApplicationContext has a displayName property, which I assume is analogous to the display-name tag in a web.xml file. However, when I set this property in…
Brian
  • 153
  • 1
  • 9
11
votes
4 answers

Spring Framework 4.0 Sample application

I haven't kept up with all of the changes to the spring framework since 2.5. I am looking for a sample application for 4.0 that has a basic skeleton app with hibernate done the 4.0 way with controllers and services. I've googled and looked at the…
Thom
  • 14,013
  • 25
  • 105
  • 185
11
votes
4 answers

Is there a Maven repository for Spring 4?

I'm looking for Spring 4.0 M1, for use with Java 8. According to this issue there should be a build, can't find however. Ideally there would be a Maven repo, but I can't even find a regular download?
Nicolas Mommaerts
  • 3,207
  • 4
  • 35
  • 55
10
votes
2 answers

Spring 4 AOP @Aspect isn't triggering for @RestController

I have created an Aspect which performs a basic id comparison to ensure that a user belongs to a the same group that created the entity being requested. I have had success attaching my aspect to @Service methods, but it doesn't make sense on the…
Nephthys76
  • 615
  • 2
  • 8
  • 23
10
votes
2 answers

hibernate 5 and spring - generate ddl using SchemaExport

In hibernate 4 - spring 4 setup it was possible to generate DDL using SchemaExport object: LocalSessionFactoryBean sfb = (LocalSessionFactoryBean) context.getBean("&sessionFactory"); SchemaExport schema = new SchemaExport(sfb.getConfiguration()); …
Jan Zelenka
  • 101
  • 1
  • 6
10
votes
1 answer

Spring's ResponseBodyAdvice: Order of execution?

I want to implement a custom ResponseBodyAdvice, which simply looks for Page and then adds the number of total elements to the response headers. @ControllerAdvice public class PageResponseAdvice implements ResponseBodyAdvice { …
Benjamin M
  • 23,599
  • 32
  • 121
  • 201
10
votes
1 answer

Stomp over websocket : The send buffer size exceeded the allowed limit

At client side I am using Stomp for websocket connection and server side I am using Spring 4 It client side I did configuration as var socket = new SockJS(urlBase + "/" + contextroot+'/hello'); stompClient = Stomp.over(socket); Below code…
Deepak Mule
  • 437
  • 5
  • 21
10
votes
2 answers

Spring 4 and Rest WS integration

I have been doing a poc on Spring4 and RestWS integration. I am new to both with barely a weeks exposure. I am following instructions from blogs. I understand that in Spring 4 and restWS setup jackson-core/anotation/databind 2 is to be used for…
suvojit
  • 311
  • 1
  • 6
  • 18
1 2
3
41 42