spring

Spring: Proper way to make the Model available to the Controller?

Given the following controller, @Controller public class MyController { ... @RequestMapping("/data") public @RequestBody Data getData(@RequestParam String id) { return myCustomModel.queryForData(id); } } what is the proper way to configure it so that myCustomModel (something that is queried for Data) is ...

How do I have common error page templates with tiles in a Spring/MVC 3.0 app?

I have a Spring MVC/3.0 app using tiles as it's view, this is working fine however I can't figure out how to get the error pages to also use tiles. I have in my web.xml <error-page> <error-code>404</error-code> <location>/WEB-INF/error/404.jsp</location> </error-page> which works fine as an ordinary view NOT using tiles, however ...

Spring Security 3: Problem autowiring UserDetailsManager/JdbcUserDetailsManager

I'm working through Peter Mularien's Spring Security 3, and am having a problem setting up the UserDetailsManager. I create the JdbcUserDetailsManager bean as follows: <bean id="jdbcUserService" class="org.springframework.security.provisioning.JdbcUserDetailsManager"> <property name="dataSource" ref="mySqlDb" /> <property name=...

Setup Connection Pooling in Spring MVC

Hi All, Can somebody help me setup connection pooling in Spring MVC. Later next month, I will release my first local intranet website powered by Spring MVC 2.5 and Jquery. This is my first attempt at web development =) I am not sure but, I am only using this in my spring configuration file and I saw this in the Spring MVC step By Ste...

create a new hibernate session in multi-thread program

How to create a new hibernate session at a new thread ? The SessionFacatory was managed by Spring. ...

Examples of Websites built using Spring, Play Framework, Struts

Hi, I am a beginner in Java and going to build a webapp that allows developers to work online on their projects. Something of the sort of bitbucket or github. I have developed sites using PHP and moving away from it. I was suggested that I should go with Spring Framework as it has a good learning curve and that it will probably look go...

Spring alternative to TimerService in EJB 3

We're using EJB TimerService:s for controlling tasks that needs to be executed on demand or triggered via a cron expression some will run every night e.g. statistic collectors and some will run every 10s e.g. checking for new orders needed to be processed we must also be able to turn them on and off. It works fine most of the time but so...

Spring logging by package name

I need to log many classes in some packages in a project which I can not change its source code. So I need a solution which I can specify package name, and with spring aop add logging to that package's classes without change them but I dont know how can I do that. How can I do that? ...

Http Session Management / Alternative Session Management (in Java)

Hi guys, I'll try as best as possible to explain what I'm doing in order to get best possible advice/solution. This is all done in java. My client has a SWING based desktop application that will load using WebStart. I was assigned to create a Session Manager for user account information. My friend suggested to rather use Http Session ...

How can I see from which TransactionManager given transaction is created in Spring 3.0

In my spring configuration I have two transaction managers defined for two different databases. Is there a way in spring to check on runtime whether given method is running inside transaction and secondly (and more importantly) from which transaction manager was this transaction created. ...

Problems deploying Spring 2 aplication in Apache Tomcat 6

I'm trying to starting up with a Spring 2 + Struts 2 + Hibernate 3 arquitecture project, but I get an exception when deploy it in Apache Tomcat 6.0 within Eclipse (Helios version). Tomcat's exception on start: GRAVE: Error configurando escuchador de aplicación de clase org.springframework.web.context.ContextLoaderListener java.lang.Cla...

Error Showing Data Base Data with Spring MVC

Hello ! Im so grateful of the help this community has offered on my learning and production experience, i come to you with another question, thank you in advance. Ok, i have a Flex + Spring + Hibernate + Tomcat + Mysql application that has been in development for 3 years. So now i need to add some html views on them. So what i intend t...

how spring mvc tag works ?

Hi there, I am trying to write some kind of raw html to mimic what spring mvc tag produces after page rendering(and I do make them look exactly the same if you open them with a html element inspector). as I want to create dynamic input form using javascript. but it didn't work. it seems I had to use only what it offers: e.g. <form:input ...

Why use a Url Rewrite Filter in Spring?

A Spring app I'm using declares a Tuckey UrlReWrite Filter and then sets up a rewrite rule as the following: <rule> <from>^/(.*)$</from> <to last="true">/app/$1</to> </rule> Why do this? Will Spring not be able to recognize requests that do not go to the /app/ url? Otherwise what is the advantage of this redirect? ...

JPA, Spring, Hibernate problem with loading entities ManyToMany Assotiation

I'm trying to get data from assotiation N:N, but I receive blank field. There are my Hibernate mapping class: @Entity @Table(name = "companies") public class Company extends NamedEntity { //some_code @ManyToMany( targetEntity = com.hqcargo.shippingstock.domain.CompanyProfile.class, cascade = {CascadeType.ALL, CascadeTy...

RESTful URLs: "Impractical" Requests, and Requiring One of Two Request Parameters...

I have a RESTful URL that requires either the offset or the prefix request parameter (but not both). GET /users?offset=0&count=20 GET /users?prefix=J&count=20 What's the best way to enforce this rule? Spring has the @RequestParam annotation with the 'required' property for optional parameters, but I want to enforce an "either-or" rule...

Recommended alternative to abusing UserDetailServiceImpl for non-user-related database lookups?

In the project I am working with, there is a UserDetailServiceImpl class which carries out all of the user-related database lookups. The problem is, I have gotten into the bad habit of doing non-user-related database lookups there too and using the UserDetailServiceImpl class as a default lookup service to avoid doing database lookups ...

Spring Framework: Map - Value Referencing to another Map

I have a map declaration: <!-- SOME MAP --> <util:map id="someMap" map-class="java.util.HashMap" key-type="java.lang.String" value-type="java.lang.String" > <entry key="0" value="SOME VALUE" /> <entry key="1" value="SOME VALUE 2" /> <entry key="default" value="SOME VALUE 3" /> </util:map> <!-- SOME MAP REFERENCE --> <util:map...

how to set SqlMapClientTemplate from spring xml

I've got following java class. package com.org.data.dbresource; import org.springframework.orm.ibatis.SqlMapClientTemplate; public class DBConnectionManager { private SqlMapClientTemplate sqlMapClientTemplate; public void setSqlMapClientTemplate (SqlMapClientTemplate sq) { this.sqlMapClientTemplate = sq; } ...

spring 3 propertyeditor throws exception

Hi @all! New Problem: I register / bind my custom property editor and get an java.lang.IllegalArgumentException - as expected. The problem: I do not know how to create a custom error message if binding fails. Any idea? THX! @InitBinder( { "playerCreationBean" } ) protected void initBinder( final WebDataBinder binder ) { binder.reg...