Skip to content
Advertisement

Tag: spring

How to disable @PostConstruct in Spring during Test

Within a Spring Component I have a @PostConstruct statement. Similar to below: During Unit tests I would not like to have the @PostConstruct function called, is there a way to telling Spring not to do post processing? Or is there a better Annotation for calling a initiation method on a class durning non-testing ? Answer Since you are not testing

Making Spring 3 MVC controller method Transactional

I am using Spring 3.1 and have my DAO and service layer(transactional) written. However in a special case to avoid a lazy init exception I have to make a spring mvc request handler method @transactional. But It is failing to attach transaction to that method. Method name is ModelAndView home(HttpServletRequest request, HttpServletResponse response). http://forum.springsource.org/showthread.php?46814-Transaction-in-MVC-Controller From this link it seems it

Spring AOP Advice Called Twice

For some reason, my Spring AOP advices are being called twice. I checked: Spring AOP advice is called twice but I am not using the Component annotation, and am declaring the aspect bean once and annotating it with @Aspect and that’s it. Somewhat belatedly I realized that one of my classes was not implementing an interface yet, which caused CGLIB2

How to use for checking multiple Roles?

I want to display some content conditionally based on Roles using Spring Security JSP taglibs. But in Spring Security 3.1.x is checking for only one role. I can use but ifAllGranted is deprecated. Any help? Answer There is a special security expression in spring security: hasAnyRole(list of roles) – true if the user has been granted any of the roles

Error creating bean with name ‘org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter’

I am trying out a simple spring web service application. I have configured the application correctly but when i try access the wsdl file i get the following error: Here are my configuration files: ws-config.xml web.xml app-config.xml downloadMessageRequest.xsd Edit pom.xml Answer Do you have spring-expression in your Maven dependencies ? If you are not using Maven, check your WEB-INF/lib folder.

Calling @Transactional methods from another thread (Runnable)

Is there any simple solution to save data into database using JPA in a new thread? My Spring based web application allows user to manage scheduled tasks. On runtime he can create and start new instances of predefined tasks. I am using spring’s TaskScheduler and everything works well. But I need to save boolean result of every fired task into

Advertisement