Tag Archives: spring framework

Database Configuration with Spring 3.2 Environment Profiles

Database Configuration with Spring 3.2 Environment Profiles This is a followup to my previous blog Spring 3.1 Environment Profiles Let’s demonstrate how to configure an application to use different databases based on configuration. The code below is using Spring JavaConfig, … Continue reading

Posted in Annotations, Java, JUnit, Spring, Spring Data, Testing | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment

Enterprise Spring Framework Best Practices – Part 3 – XML Config

Enterprise Spring Best Practices Series In part 3, Spring XML Configuration. The best thing about Spring is that there are several way to solve a problem, the worst thing about Spring is that there are several ways to solve a … Continue reading

Posted in Java Util Logging, SLF4J, Spring | Tagged , , , , , , , | 5 Comments

Spring 3.1 Constructor Namespace

Spring Namespaces Spring provides several namespaces to simplify XML configuration, such as jdbc, tx, aop, etc. We Spring developers are already familiar with the required beans namespace. <beans> <bean id=”dataSource” class=”…”/> <bean id=”messagingProvider” class=”…”/> </beans> Spring Namespaces are defined at … Continue reading

Posted in Spring, Spring Framework | Tagged , , , , | Leave a comment

Spring 3.1 Environment Profiles

Spring 3.1 Environment Profiles Profiles Spring 3.1 now includes support for the long awaited environment aware feature called profiles. Now we can activate profiles in our application, which allows us to define beans by deployment regions, such as “dev”, “qa”, … Continue reading

Posted in JUnit, Spring, Spring Framework, Testing | Tagged , , , , , | 3 Comments

What is in my Cloud Environment?

I put together Java sample applications using Spring 3.1. Using Spring’s Environment abstractions, we can gather details about the underlying platform. See the following sample pages Jelastic: http://petclinic.jelastic.servint.net/clinic/environment Heroku: http://evening-window-9861.herokuapp.com/environment CloudBees: http://roobees.gdickens.cloudbees.net/environment Environment Bean package com.gordondickens.roobees.util; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; … Continue reading

Posted in Cloud, CloudBees, Heroku, Jelastic, Spring, Spring Roo | Tagged , , , , , , , | Leave a comment

Simpler JPA with Spring Data-JPA

How to configure your Spring application with Simple CRUD configuration with Spring Data-JPA. 1. Add Spring Data-JPA to project configuration. In your Maven pom.xml file <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-jpa</artifactId> <version>1.2.0.RELEASE</version> </dependency> 2. Configure JPA Entity … @Entity public class Product { … Continue reading

Posted in Hibernate, JPA, Spring, Spring Data, Spring Framework | Tagged , , , , , , | 12 Comments

Annotation Reference for Spring Projects

Annotations are available for Spring and Java projects. I was unsuccessful in finding a single consolidated set of the annotations. So, I thought “What a great gap to fill.” However, what I thought would be a fairly simple endeavor, turned … Continue reading

Posted in Annotations, AOP, Hibernate, Java, JMX, JPA, JUnit, REST, SOAP, Spring, Spring AOP, Spring Batch, Spring Framework, Spring Integration, Spring MVC, Spring Roo, Spring Security, Web Flow, Web Services | Tagged , , , , , , , , , , , , , , | 9 Comments

Spring Expression Language (SpEL) Predefined Variables

Spring 3.0 introduced Spring Expression Language (SpEL). There are two variables that you have available “systemProperties” and “systemEnvironment“. SpEL allows us to access information from our beans and system beans information at runtime (late binding). These can be applied to … Continue reading

Posted in SpEL, Spring, Spring Framework | Tagged , , , , , , , | 2 Comments

Using Default Values for Properties in Spring

Defaults for Property Values? I didn’t know that? I was looking through the Spring Greenhouse application and discovered an existing feature that I was unaware of. We can set a default value when configuring PropertyPlaceholderConfigurer. 1. Set the default value … Continue reading

Posted in Roo, Spring, Spring Framework | Tagged , , , | 5 Comments