O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring ConnectionFactory

For the ConnectionFactory interface, there is a concrete implementation CachingConnectionFactory which, by default, creates a single connection proxy that can be shared by the whole application. The code used to create CachingConnectionFactory is as follows:

@Beanpublic ConnectionFactory connectionFactory() {        CachingConnectionFactory connectionFactory = new         CachingConnectionFactory("localhost");        connectionFactory.setUsername("guest");        connectionFactory.setPassword("guest");        return connectionFactory;}

We can also configure cached connections using CachingConnectionFactory as well as just channels. We need to set the cacheMode property to CacheMode.CONNECTION using setCacheMode(). We can also limit the total number ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required