Archives

Spring EntityManager createNativeQuery return Object[]

Scenario: You are lazy and don’t want to create an @Entity class and just want to query a few columns.

Rate this:

Read More

Caching using Spring and Ehcache

Configure EhCache Cache Manager EhCache Configuration Cache Customer Service ~ Cached and CacheEvict

Rate this:

Read More

Spring Custom Profiles Configuration and Testing

@ActiveProfiles for Junit AnnotationConfigApplicationContext setActiveProfiles to active profile Maven run test for active profile

Rate this:

Read More

Spring JPA Embeddable Id example

Embeddable Entity Embeddable Id as @Id

Rate this:

Read More

Spring using PropertySource with @Value

If you are using @Value with @PropertySource create a PropertySourcesPlaceholderConfigurer Bean which resolves ${…} placeholders within @Value annotations against the current Spring Environment and its set of PropertySources.

Rate this:

Read More

Spring JPA No qualifying bean of type: javax.persistence.EntityManagerFactory

You can define two EntityManagers in one class: 1. Provide a name for your EntityManager Beans 2. Provide a persistentUnitName and make sure it is unique. As the entityManager injects by name into the transaction manager make sure you entitymanager bean name is same as your transaction manager parameter. In this case my entitytManager bean […]

Rate this:

Read More

Spring Redis Cache Service on Heroku

1. Setup Heroku RedisConnectionFactory Configuration 2. Setup RedisTemplate Configuration 3. Setup Redis Service 4. Setup Redis Controller 1. Setup Heroku RedisConnectionFactory Configuration 2. Setup RedisTemplate Configuration 3. Setup Redis Service 4. Setup Redis Controller

Rate this:

Read More

Spring Data MongoDB with Spring MVC

Below is the steps to create a Spring MVC application with MongoDB 1. Create MongoDB Entity 2. Define MongoDB DataSource 3. Define MongoDBTemplate 4. Create MongoDB Repository interface 5. Implement MongoDB Repository interface 6. Define your MongoDB Controller 7. Test MongoDB DataSource 8. Test MongoDBTemplate 9. Test MongoDB Repository Create MongoDB Entity Define MongoDB DataSource […]

Rate this:

Read More

Salesforce Integration JUnit Testing Using Spring

Spring Configuration to test integration to Salesforce using PartnerConnection, EnterpriseConnection and BulkConnection. Create a properties file called salesforcesync.properties with all the login details salesforcesync.properties Salesforce Authentication Spring Configuration Junit test class to assert login was successful

Rate this:

Read More