spring

Can I compose a Spring Configuration File from smaller ones?

I have a handful of projects that all use one project for the data model. Each of these projects has its own applicationContext.xml file with a bunch of repetitive data stuff within it. I'd like to have a modelContext.xml file and another for my ui.xml, etc. Can I do this? ...

What are the best books for Spring and Spring MVC?

My team is about to build a new product and we are using Spring and Spring MVC. There are other book posts on stackoverflow, but I couldn't find one that matched my needs. My manager will be purchasing books for our team to use as a resource so... What are the best books about Spring? (Please list each book suggestion in a separate an...

Internationalization sitemesh

I'm using freemarker, SiteMesh and Spring framework. For the pages I use ${requestContext.getMessage()} to get the message from message.properties. But for the decorators this doesn't work. How should I do to get the internationalization working for sitemesh? ...

Does having many unused beans in a Spring Bean Context waste significant resources?

My model layer is being used by a handful of different projects and I'd like to use a single XML Spring Configuration file for the model regardless of which project is using it. My question is: Since not all beans are used in all projects am I wasting resources to any significant amount if there not being instantiated? I'm not too sure...

Java Frameworks War: Spring and Hibernate

My developers are waging a civil war. In one camp, they've embraced Hibernate and Spring. In the other camp, they've denounced frameworks - they're considering Hibernate though. The question is: Are there any nasty surprises, weaknesses or pit-falls that newbie Hibernate-Spring converts are likely to stumble on? PS: We've a DAO libra...

spring & web service client - Fault Detail

Hi, How could I get the Fault Detail sent by a SoapFaultClientException ? I use a WebServiceTemplate as shown below : WebServiceTemplate ws = new WebServiceTemplate(); ws.setMarshaller(client.getMarshaller()); ws.setUnmarshaller(client.getUnMarshaller()); try { MyResponse resp = (MyResponse) = ws.marshalSendAndReceive(WS_URI, req);...

Reuse Spring Webflow definitions with different action implementations

Hi, I got pretty big webflow definition, which I do not want to copy/paste for reusing. There are references to action bean in XML, which is kind natural. I want to use same flow definiton twice: second time with actions configured differently (inject different implementation of service to it). Is there easy way to do this? ...

How to configure ResourceBundleViewResolver in Spring Framework 2.0

Everywhere I look always the same explanation pop ups. Configure the view resolver. <bean id="viewMappings" class="org.springframework.web.servlet.view.ResourceBundleViewResolver"> <property name="basename" value="views" /> </bean> And then put a file in the classpath named view.properties with some key-value pairs (don't mind the...

Any good tutorials/examples for the Spring Security Framework?

Any good tutorials or samples on spring security. Thanks ...

How do I get the value of the jdbc.batch_size property at runtime for a Web application using Spring MVC and Hibernate?

According to what I have found so far, I can use the following code: LocalSessionFactoryBean sessionFactory = (LocalSessionFactoryBean)super.getApplicationContext().getBean(" System.out.println(sessionFactory.getConfiguration().buildSettings().getJdbcBatchSize()); but then I get a Hibernate Exception: org.hibernate.HibernateE...

Can Spring Parse and Inject Properties Files?

I already know how to: Load properties files into my Spring configuration using: <context:property-placeholder location="aaa/bbb/ccc/stuff.properties"/> Build properties objects on the fly using: <props><prop key="abc">some value</prop></props> But what I cant do, and would be really useful, is to have Spring load a properties fil...

How to unit test a DAO that is extending SqlMapClientDaoSupport

Spring DA helps in writing DAOs. When using iBATIS as the persistence framework, and extending SqlMapClientDaoSupport, a SqlMapClient mock should be set for the DAO, but I can't do it. SqlMapClientTemplate is not an interface and EasyMock cannot creates a mock for it. ...

Spring JTA TransactionManager config: Supporting both Tomcat and JBoss

I have a web application using JPA and JTA with Spring. I would like to support both JBoss and Tomcat. When running on JBoss, I'd like to use JBoss' own TransactionManager, and when running on Tomcat, I'd like to use JOTM. I have both scenarios working, but I now find that I seem to need two separate Spring configurations for the two ca...

Preferred way to do logging in the SpringFrame work

I have done some searches looking for information about how to do logging with the Spring Framework. We currently have an application that has no logging in it except for system.out statements (very bad way). What I would like to do, is add logging, but also want to be able to control the logging at run time, with say JMX. We are usin...

Multiple Session Factories under Spring/Hibernate

I have been given a requirement where I need to support multiple databases in the same instance, to support multi-tenancy. Each DB has an identical schema. The user logs into a specific database by choosing from a list, and all subsequent calls will go to that DB until they log out. I want to hot swap the session factory inside a single...

How to define / configure priority for multiple aspects using Spring AOP (or AspectJ)

Hi, I have been able to define multiple aspects (one is @Before and another is @Around) using Spring AOP (combined with AspectJ annotations) over a business service class. Currently they are getting called one by one (in sequence). However I would like to know how the priority of calling the aspects can be defined and where. Please gu...

Spring vs. JSF

I have a dilemma at my job. We're looking to integrate two different J2EE projects and they both use different frameworks for the web component. We're also looking to add more dynamic capability/AJAX to it. One uses JSF and the other uses Spring. Basically we're trying to pick one of the projects and integrate them using that technol...

What is the 'best' way to do distributed transactions across multiple databases using Spring and Hibernate

I have an application - more like a utility - that sits in a corner and updates two different databases periodically. It is a little standalone app that has been built with a Spring Application Context. The context has two Hibernate Session Factories configured in it, in turn using Commons DBCP data sources configured in Spring. Curr...

Getting Spring Application Context

Is there a way to statically/globally request a copy of the ApplicationContext in a Spring application? Assuming the main class starts up and initializes the application context, does it need to pass that down throw the call stack to any classes that need it, or is there a way for a class to ask for the previously created context? (Whi...

What are the benefits of dependency injection containers?

I understand benefits of dependency injection itself. Let's take Spring for instance. I also understand benefits of other Spring featureslike AOP, helpers of different kinds, etc. I'm just wondering, what are the benefits of XML configuration such as: <bean id="Mary" class="foo.bar.Female"> <property name="age" value="23"/> </bean> <b...