Category Archives: Programming

CXF SOAP Client Example to Use Plain Text Password Authentication

CXF SOAP client can be configured to support various web authentication strategies via its out WSS4JOutInterceptor. For example it can be configured to support plain text username/password or digest based authentication. This post will show the plain text case.¬† First … Continue reading

Posted in Java | Tagged , , , , | Leave a comment

CXF REST Client Parses Badgefish JSON Data

Badgerfish is one of the JSON conventions supported by CXF. To use it with CXF RS Client, you need to add both cxf-rt-rs-extension-providers and cxf-rt-rs-client to your dependencies. Then you can create a JSON provider and pass it to the … Continue reading

Posted in Java | Tagged , , , | Leave a comment

ActiveMQ Message Expiration

When a message is produced, you can specify its timeToLive in milliseconds. This duration is added to the message every time when the message failed to be consumed. If there is no attempt to consume the message (i.e. consumer detached) … Continue reading

Posted in Java | Tagged , , , , , | Leave a comment

Hibernate Fetch Lazy Child Entities with HQL and Native SQL

In one-to-many or many-to-many relationship, we often configure Hibernate to lazily fetch the children collection for performance reasons by reducing the database join operation and the amount of the data been pulled and transmitted from database to application. The application, … Continue reading

Posted in Database, Java | Tagged , , , , , , , , | Leave a comment

Use Hamcrest Matchers in JMockIt

JMockIt, when used together with Hamcrest matchers, can sometimes create very flexible verifications in unit test. This is demonstrated in the gist here. The test class GameConrollerTest defines a test target (with @Tested) and a mocked object (in this case … Continue reading

Posted in Java | Tagged , , , , | Leave a comment

Spring Bean Configure XML Accessing Context.xml JNDI Resources

Tomcat context.xml can expose environment variables accessible by Spring bean configuration xml files. Problem: Sometimes you want to¬†externalize some application properties, such as password or QA/Production specific settings, used by Spring beans. There are a few options for doing so … Continue reading

Posted in Java | Tagged , , , , , , | Leave a comment

Use SpringBoot to Deploy ActiveMQ Broker to Tomcat-2/3

This post is to continue the first part of the same topic. It mainly covers: Use commercial database as the data store Use the embedded Tomcat to manage the data source connection pool Background Despite the fact that the ActiveMQ … Continue reading

Posted in Java | Tagged , , , , | 1 Comment