spring-3

Minimum JARs for Spring 3.0 dependency injection

☆樱花仙子☆ 提交于 2019-12-03 06:50:50
Similarly to this question regarding an earlier Spring version , what are the minimum dependencies required for an application to use Spring 3.0 dependency injection only? The application context will be configured by XML only. Spring depends on a logging framework, so assume I already include these JARs for logging: jcl-over-slf4j.jar logback-classic.jar logback-core.jar slf4j-api.jar As stated in another answer, maven is the true path. If; however, you choose to stray, then based on section "1.2.1 Core Container" of the Spring Reference I believe these to be the minimum jars for core spring

Upgrading to springframework.scheduling.concurrent?

梦想的初衷 提交于 2019-12-03 06:10:17
As of Spring 3.0 the ScheduledTimerTask is deprecated and I can't understand how to upgrade to org.springframework.scheduling.concurrent. <bean id="timerFactoryBean" class="org.springframework.scheduling.timer.TimerFactoryBean"> <property name="scheduledTimerTasks"> <list> <ref bean="onlineTimeSchedule" /> </list> </property> </bean> <bean id="onlineTimeSchedule" class="org.springframework.scheduling.timer.ScheduledTimerTask"> <property name="timerTask" class="com.example.OnlineTimerTask" /> </property> <property name="period" value="60000" /> <property name="delay" value="1000" /> </bean>

How to set 'Content-Disposition' and 'Filename' when using FileSystemResource to force a file download file?

∥☆過路亽.° 提交于 2019-12-03 05:38:26
问题 What is the most appropriate, and standard, way to set the Content-Disposition=attachment and filename=xyz.zip using Spring 3 FileSystemResource ? The action looks like : @ResponseBody @RequestMapping(value = "/action/{abcd}/{efgh}", method = RequestMethod.GET, produces = "application/zip") @PreAuthorize("@authorizationService.authorizeMethod()") public FileSystemResource doAction(@PathVariable String abcd, @PathVariable String efgh) { File zipFile = service.getFile(abcd, efgh); return new

Spring MVC: How to remove session attribute?

為{幸葍}努か 提交于 2019-12-03 05:05:46
问题 Example of using @SessionAttributes below. How to clear user session attribute after wizard finished ? In my example after returning to /wizard0 session attribute still exists. I've tried status.setComplete() and session.removeAttribute("user") but it doesn't work. @Controller @SessionAttributes("user") public class UserWizard { @RequestMapping(value = "/wizard0", method = RequestMethod.GET) public String page1(Model model) { if(!model.containsAttribute("user")) { model.addAttribute("user",

Can @PathVariable return null if it's not found?

旧时模样 提交于 2019-12-03 04:14:22
问题 Is it possible to make the @PathVariable to return null if the path variable is not in the url? Otherwise I need to make two handlers. One for /simple and another for /simple/{game} , but both do the same just if there is no game defined i pick first one from a list however if there is a game param defined then i use it. @RequestMapping(value = {"/simple", "/simple/{game}"}, method = RequestMethod.GET) public ModelAndView gameHandler(@PathVariable("example") String example, HttpServletRequest

Jetty addFilter with Spring Security and no web.xml

坚强是说给别人听的谎言 提交于 2019-12-03 03:39:39
Normally I would have added org.springframework.web.filter.DelegatingFilterProxy with a snippet like this to web.xml: <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class> org.springframework.web.filter.DelegatingFilterProxy </filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> But with Servlet 3.0 Container and Jetty, I've removed web.xml. I'm trying to add DelegatingFilterProxy to Jetty's launch with: context.addFilter(DelegatingFilterProxy.class, "/*", EnumSet.allOf

MVC Java Config - HandlerInterceptor not excluding paths

烈酒焚心 提交于 2019-12-03 03:14:44
I have a MVC Java configuration but the HandlerInterceptor is not excluding some patterns. At the line marked with xxx , if 1) I add both addPatterns("/**") and excludePathPatterns("*.ecxld") to the HandlerInterceptor 's InterceptorRegistration , the HandlerInterceptor.preHanlde() is NOT invoked at all. e.g .addPathPatterns("/**").excludePathPatterns("*.ecxld") 2) I add only excludePathPatterns("*.ecxld") to the HandlerInterceptor 's InterceptorRegistration , the HandlerInterceptor.preHanlde() is still executed. (the other interceptors are invoked fine). Any pointers appreciated. Thanks

A component named 'XXX' is already defined in this module in JBoss 7.1.1

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 02:34:10
I did not create the spring bean name with TimerServiceDispatcher in my application. But, the JBoss throw exception because of TimerServiceDispatcher is already defined in this module. I don't know what is the problem. What I am missing? What I need to do? My application use Seam 2.3, Spring 3.0 and JPA 2.0. I don't use EJB . 11:29:01,531 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "MRBS.war" 11:29:04,217 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.unit."MRBS.war".PARSE: org

Creating unitary tests in Spring 3

帅比萌擦擦* 提交于 2019-12-03 00:26:35
I'm starting on testing applications in general and I want to create several tests to learn Mockito in Spring. I've been reading several information but I have some general doubts I'd like to ask. I have seen come Mockito tests and they annotate the test of the class with: @RunWith(MockitoJUnitRunner.class) while in the Spring documentation it is used @RunWith(SpringJUnit4ClassRunner.class) . I don't know what's the difference between them and which one should I use for a Spring application where tests use Mockito. As I haven't seen any real application that has test I'd like to know typical

Downloading Spring Jars without using Maven

扶醉桌前 提交于 2019-12-02 22:38:18
How do you download Spring Framework jars if you can't stand Maven or any of the other build management tools. From what I can tell it seems you have to spend many frustrating hours on Google to find out how to do this. I thought Spring was supposed to be easy. All I'm trying to do is to write a simple Hello World application using Eclipse and Tomcat. Why is it so difficult with Spring 3? go there http://repo.spring.io/release/org/springframework/spring/ you can see all versions, like old school Why can't you stand Maven? I like Maven, but I really like Gradle . Either way, if you only build