This short post publishes a Restful Web Service and then tests @Put and @Post methods using rest-shell. Create the Service Follow the instructions from my previous post: Produce Json From Restful CXF Web Service. Once you have done this, modify the CustomerService as follows: This provides methods to Put and Get data. Test the Service... Continue Reading →
Produce Json From Restful CXF Web Service
In this post, we are going to create a simple Restful web service that returns json. This post follows on from Create Restful Web Services with JBoss, Maven, Apache CXF and Spring, but is also self-contained. Create the Project Using Eclipse / JBoss Developer Studio New -> Maven Projectmaven-archetype-webappGroup Id: com.skills421.webservicesArtifact Id: SimpleCXFRest The default project structure... Continue Reading →
Create Restful Web Services with JBoss, Maven, Apache CXF and Spring
In this short post, we are going to create a simple restful web service using Apache CXF, Spring, and JBoss AS7. Create the Project Using Eclipse / JBoss Developer Studio New -> Maven Projectmaven-archetype-webappGroup Id: com.skills421.webservicesArtifact Id: SimpleCXFRest The default project structure will be created as follows: Add Missing Folders and Delete index.jsp Right-click src/mainNew -> Folder... Continue Reading →
Drools, Camel and Spring
Objectives In this example we will integrate Drools, Spring and Camel. We will first execute a test to show that our Rules are firing using just Drools Next we will test our Spring / Drools integration is working by loading a Drools Stateful Session bean and firing the rules associated with it. We will then... Continue Reading →
Connecting Drools 5.6 with Spring 3.x
This post is concerned predominantly with linking Spring3.x and Drools5.6. We will configure Spring, Drools and create a simple rule to test that we are up and running. Add the Drools Plug-in to Spring STS Start Eclipse Help -> Install New Software Work With: http://download.jboss.org/drools/release/5.5.0.Final/org.drools.updatesite/ click the "Add" button Name: Drools Check the Drools and... Continue Reading →
annotated Java Bean to read config.properties
This example is a little contrived in order to keep it simple. So far we have only covered Spring beans that are defined using the spring-config.xml. In this example we will use annotations in the bean class declaration to identify it as a Spring bean and then tell Spring where to look for these beans.... Continue Reading →
Spring , @Resource, @PostConstruct and @PreDestroy
Spring supports JSR-250 which provides @Resource, @PostConstruct and @PreDestroy annotations. @Resource The @Resource annotation is used in the bean class and is attached to the setter methods of the properties. It is used to inject a specific bean resource. - will look for a bean with the same name as the property XXX - will... Continue Reading →
Spring context:annotation-config
In our previous examples we have to define a bean for each BeanPostProcessor we wanted to use. Spring provides a shortcut to do this in the context namespace. We simply need to add the context namespace to our declared namespaces at the top of our config xml file and add the context:annotation-config to our bean... Continue Reading →
@Autowired and @Qualifier Annotations for Spring
We use @Autowired to automatically wire our bean dependencies. Example In the following example, we have autowired the home address for our student from the previous example. Spring will look for a single bean with a type that matches the type for home. If it finds this bean then it will automatically inject that bean... Continue Reading →