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
6
votes
1 answer

Push message from Java with Spring 4 WebSocket

I'd like to push messages from Java to WebSocket clients. I've successfully made a js client send to the server and receive a message back on 2 js clients, so the client side code works fine. My issue is that I'd like to initiate a send when events…
James
  • 1,720
  • 5
  • 29
  • 50
6
votes
1 answer

Configure External Broker(RabbitMQ) In Spring4+STOMP+SockJS Application

I am working on a chat application developed using Spring4 Messaging and STOMP implemented with SockJS. The application works fine when I use the Simple Message Broker : config.enableSimpleBroker("/queue/", "/topic/"); But, now we have a…
Gurminder Singh
  • 1,755
  • 16
  • 19
6
votes
2 answers

dynamic message-mapping for websockets in Spring 4

I want to develop a small chat with springs new websocket/stomp support. I guess i cannot use something like this: @MessageMapping("/connect/{roomId}") @SendTo("/topic/newMessage") public String connectToChatRoom(@PathVariable String roomId,…
kentobi
  • 491
  • 1
  • 7
  • 10
5
votes
4 answers

How to mock absent bean definitions in SpringJUnit4ClassRunner?

I have a Spring 4 JUnit test which should verify only a particular part of my application. @WebAppConfiguration @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:context-test.xml") @ActiveProfiles("test") public class…
Andremoniy
  • 34,031
  • 20
  • 135
  • 241
5
votes
3 answers

How do I figure out what object my session is trying to serialize?

I recently upgraded to Spring Security 4.2.3.RELEASE. I'm also using spymemcached v 2.8.4. I'm running into this situation where for some reason Spring is trying to serialize service implementation classes. I can't figure out where this is coming…
Dave
  • 15,639
  • 133
  • 442
  • 830
5
votes
1 answer

Using Spring WebSocket's SimpMessagingTemplate with multi endpoint configuration

I'm using Spring 4.3.5 and WebSocket with SockJS, STOMP and SimpleBrokerMessageHandler. In my application I have three separate WebSocket endpoints running on a different address: /endPointA, /ednpointB, /endpointC To be even more specific, I have…
Kristoff
  • 326
  • 2
  • 13
5
votes
1 answer

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.exception.ConstraintViolationException.class}) public…
pheromix
  • 18,213
  • 29
  • 88
  • 158
5
votes
2 answers

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.annotation.RequestMapping import…
MonkeyMonkey
  • 826
  • 1
  • 6
  • 19
5
votes
1 answer

How to configure 'entityCacheStrategies' in spring4.3.x

I am migrating from spring3.x to spring4.3.x. I am using org.springframework.orm.hibernate5.LocalSessionFactoryBean in bean creation as follows
Achaius
  • 5,904
  • 21
  • 65
  • 122
5
votes
1 answer

HibernateTemplate is throwing java.lang.NoSuchMethodError: org.hibernate.Session.getFlushMode() -- Spring4.2.6, Hibernate5.2

I have looked around similar postings with SessionFactory and missing Main(). My problem is not related to them. Not sure if any jar is a mismatch. I am trying a sample Spring4.2.6 with Hibernate5.2 code using JDK8 and getting this…
ludwig17
  • 53
  • 1
  • 5
5
votes
1 answer

Spring 4 - reject "null" @RequestBody for all endpoints

Jackson deserializes the "null" string as a null request body which is expected (although it would be nice to be able to switch this behaviour off). The code below triggers validation in case of "{}" payload but not in case of "null" payload. This…
Emanuel George Hategan
  • 1,123
  • 1
  • 13
  • 22
5
votes
1 answer

How to migrate usage of JpaTemplate from Spring 3.2 to 4.1.4?

We currently have Spring 3.2.9.RELEASE configured and running (for a couples of years) and need to migrate to 4.1.4.RELEASE. We have an abstract DAO class that extends org.springframework.orm.jpa.support.JpaDaoSupport as well as other references…
Jim Athrs
  • 61
  • 1
  • 3
5
votes
2 answers

how to set default beans init-method by annotations in spring 4?

i am learning using Spring 4 by Java annotations, and i could not find how to set default init-method to all beans that belong to specific configuration, without adding the @PostContruct annotation to initialize method at all clases and neither…
jscherman
  • 5,839
  • 14
  • 46
  • 88
5
votes
1 answer

Getting error Schema abc.xsd could not be loaded. IllegalArgumentException: The resource path def.xsd has been normalized to null which is not valid

I used jaxb2-maven-plugin to generate java classes from xsd. Classes are generating. Below is sample of one of my xsd file
Basit
  • 8,426
  • 46
  • 116
  • 196
5
votes
1 answer

Custom ExceptionTranslationFilter in spring 4 to handle REST AuthenticationException

I have a spring MVC RESTful application secured by spring security. Client side is Angular JS. But my login and logout pages are plain jsp and I do form based login and log out. upon success full authentication, I load my secured page(it uses…
Mukun
  • 1,756
  • 10
  • 30
  • 57