Tag: Spring
-
Spring: Set Active Profile Using Existing JNDI
If we are using @Profile, Spring allows us select the active profile by using spring.profiles.active key. Although I can hardcode the active profile in web.xml, I want my active profile to be determined based on a JNDI string defined in the application server. PROBLEM My application servers (DEV, QA and PROD) have an existing JNDI… Read More…
-
Spring Web Services: Client Integration Testing with MockWebServiceServer
Spring Web Services provides a great way to perform web service client integration tests. However, the example in the documentation requires the client class to extend org.springframework.ws.client.core.support.WebServiceGatewaySupport, which is rather ugly. Instead, I prefer to have WebServiceTemplate injected into my client class. So, I made a slight tweak to my integration test to work this… Read More…
-
Spring: Choosing the Right Dependency Injection Approach
There are many different ways to perform dependency injection (DI) in Spring. As Spring evolves over time, the DI configuration also changes over time, which may contribute to some confusion to those who are just learning Spring. Scenario Let’s assume we have this scenario: We have Team Awesome that consists of one awesome member, called… Read More…
-
Hibernate: Migrating from XML-Based Configuration to Annotation-Based Configuration
Overview At some point of time, as your project scope grows, the Hibernate mapping XML files are going to get to a point where it becomes very difficult to maintain. This is where the annotation-based configuration comes in. It took me a few years to convince myself that annotation-based configuration is the way to go.… Read More…
-
Using Spring Web Services and JAXB to Invoke Web Service Based on WSDL
There are several ways to consume a web service based on a WSDL from Java. After trying a couple of approaches, I’m currently leaning towards Spring Web Services and JAXB. The biggest advantage of using both Spring Web Services and JAXB to consume a web service is the flexibility to change the web service URL… Read More…
-
Configuring Quartz Scheduler to Run in Clustered Environment
The goal of running a Quartz job in the clustered environment is NOT to have duplicate running jobs. The triggered job should run just one time regardless of the number of nodes in the clustered environment. Download Quartz and extract the file. Navigate to quartz-x.x.x -> docs -> dbTables and run the database SQL script… Read More…