spring

Shutting down a TaskExecutor in a web application when the web server is shutdown

I have a web application that makes use of a Spring TaskExecutor. The task executor is started when the web application is loaded for the first time and the thread runs the entire life of the web application. Ever since I added this thread to the application, Oracle Application Server will no longer shutdown gracefully. My guess is that ...

Spring 3 MVC Nesting RequestMapping

From Spring Official Document, Spring 3 MVC look to be support nesting Request Mapping. http://static.springsource.org/spring/docs/3.0.0.RELEASE/spring-framework-reference/pdf/spring-framework-reference.pdf In page 448, they mentioned: @Controller @RequestMapping("/appointments") public class AppointmentsController { //... @RequestM...

Translate Spring XML configuration to Java config

I'd like to use Spring with Java configuration, but almost all examples are writte in XML and I don't know how to translate them to Java. Look at these examples from Spring Security 3: <http auto-config='true'> <intercept-url pattern="/**" access="ROLE_USER" /> </http> <authentication-manager> <authentication-provider> ...

Which maven dependencies to include for spring 3.0?

Hi there, I am trying to do my first project with Spring 3.0 (and maven). I have been using Spring 2.5 (and primer versions) in quite some projects. Nevertheless I am kinda confused, what modules I have to define as dependencies in my pom.xml. I just want to use the core container functions (beans, core, context, el). I was used to do ...

Spring 3.0 EL How to get property from a properties file?

Using Spring 3.0 EL can we auto wire a property from a property file to a component? I know we can load a properties file using Util namespace and we can access it as a bean, but can we autowire using spring EL. <util:properties id="myProperties" location="/WEB-INF/my.properties"/> ...

Using Spring Security with EJB or Spring?

I wanted to build an application based on Java EE 6, but the security mechanisms of Java EE are not sufficient and a pain to with for my needs. Spring Security seems the best way to secure my application. Now I wonder if Spring Security + EJB is a good combination or if I should be better use Spring only. I need method interception, ACL...

Issues with setting URL mappings in Spring MVC 2.5

I have the following in my web.xml file: <servlet> <servlet-name>onBoardingUI</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>sample</servlet-name> <url-pattern>*.html</url-pattern> </servl...

Spring Transaction - Proxy confusion

<tx:advice id="txAdvice" transaction-manager="jtaTxManager"> <tx:attributes> <tx:method name="*" /> </tx:attributes> </tx:advice> <aop:config proxy-target-class="true"> <aop:pointcut id="fooServiceOperation" expression="execution(* x.y.SampClass.save(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="fooServiceOp...

How do swap implementations on a per user basis on a web application using Spring's DI

Say a web application is a central payment processing engine, where each user may have a different credit card provider that will be processing the credit card. There is an interface that all of the implementations adhere to. I want to know if there is a pattern where you could allow new implementations to be simply dropped in the depl...

Deploying to tomcat via eclipse and maven2 plugin doesn't seem to be working

I have a simple spring 3 mvc application, that just ouputs index.aspx when someone browses to http://localhost:8080/ When I do RunAs and run on server option (which is hooked into tomcat 6), it opens up the browser to http://localhost:8080/springmvc2/ (where springmvc2 is the applications name). I have build this same simple test app...

Spring MVC 3 - Respond to request with a 404?

In my controller I do a permissions check to see if the user can do the certain action. If they can't, I'd like to return a 404. How do I tell Spring to return a 404? ...

Spring Security with EJBs

Since EJB authorization is too limited for my needs I want to use Spring Security together with EJBs. For authentication I want to use Spring Security too. The question is, if I can use the Spring Security context within an EJB. The scenario: user communicates with a servlet authentication through Spring Security servlet communicates ...

Approach for a (generic) DDD Repository with JPA/Spring: does it look wrong?

I'm pretty new to DDD and JPA. I'm working on a generic Repository with JPA and Spring. I really like the approaches exposed in the articles DDD: The Generic Repository and JPA implementation patterns: Data Access Objects. My aim is to build the perfect Repository in Domain-Driven Design with JPA and Spring. I use an internal generic R...

how do I add apache commons logging using the maven2 with eclipse?

I can't seem to find apache common logging when using eclipse w/maven2 plugin. I need it for spring3 mvc apparently. ...

maven deploy goal failing

I am using eclipse with maven2 plugin. When doing a Run-As -> build with a goal of 'deploy' I am getting this error: Error message:org.codehaus.plexus.component.configurator.ComponentConfigurationException: Class 'org.apache.maven.artifact.repository.ArtifactRepository' cannot be instantiated I'm not sure I even need to do a 'deploy'...

Spring application context : webapp folder variable ?

Greetings, Is there any Spring variable for Web application folder? I want to assign a bean property as following. Where ${WEBAPP-FOLDER} is the absolute path of the web-app folder. Any tips? <bean id="compass" class="org.compass.spring.LocalCompassBean"> . . <prop key="compass.engine.conne...

Spring 3 MVC application runs on netbeans with tomcat, struggling with eclipse

I am using eclipse, tomcat6 and I have the maven2 eclipse plugin. I have tried with using my own downloaded version of tomcat6 and the built in eclipse tomcat server, both havent' worked for me. The page simply returns a 404 error from tomcat at http://localhost:8080/ (I set the context the '/') I fired up netbeans and created the ex...

Unable to deque messages from Topic after the listener listens the messages in spring jms

I am sending the messages to Topic using oracle.jms.AQjmsFactory. The messages are stored in DB topic . Using DefaultMessageListenerContainer , the messages are being listen .But the problem is the messages are not dequeueing or deleting from the topic i.e., the messages are stucked in topic. ...

Hibernate and strange behavior with DB2 sequences

I am using Hibernate with Spring and DB2. I am using sequences to generate primary key for entities. All entities use the same sequence HIBERNATE_SEQUENCE, which is the hibernate default. The problem is that values that end up into primary keys are about 10 times higher than those returned by the HIBERNATE_SEQUENCE. For example this si...

Quartz CRON trigger not fired when expected

I have a simple quartz trigger running in Spring 2.5.6-SEC01. Trigger definition looks like this: <bean id="AdvicesCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="AdvicesQuartzJob"/> <property name="cronExpression" value="0 20/15 * * * ?"/> </bean> This is my schedul...