← ResourcesConnector migration

Migrating the MuleSoft Database connector to Spring Boot

6 min read

The MuleSoft Database connector is one of the most common components in any Mule estate. It maps cleanly onto Spring's JdbcTemplate and Spring Data repositories. This guide shows the operation mapping, a worked before-and-after, and how the conversion is validated field-by-field.

Operation mapping

  • db:select → JdbcTemplate.query(...) returning a List<Map<String,Object>> or a mapped type
  • db:insert → JdbcTemplate.update(...) with named parameters
  • db:update → JdbcTemplate.update(...)
  • db:delete → JdbcTemplate.update(...)
  • db:bulk-insert → JdbcTemplate.batchUpdate(...)
  • db:stored-procedure → SimpleJdbcCall

Before and after: a select

Mule (XML)
<db:select config-ref="dbConfig">
  <db:sql>SELECT id, name FROM customers WHERE region = :region</db:sql>
  <db:input-parameters>#[{ region: attributes.queryParams.region }]</db:input-parameters>
</db:select>
Spring Boot (Java)
String sql = "SELECT id, name FROM customers WHERE region = :region";
Map<String, Object> params = Map.of("region", region);
List<Map<String, Object>> rows =
    namedParameterJdbcTemplate.queryForList(sql, params);

Configuration mapping

The Mule db:config (host, port, user, password, database) maps to Spring's standard datasource properties in application.yml, so credentials live in configuration, not code:

application.yml
spring:
  datasource:
    url: jdbc:mysql://${DB_HOST}:${DB_PORT}/${DB_NAME}
    username: ${DB_USER}
    password: ${DB_PASSWORD}

How the conversion is validated

Database operations are verified end-to-end: the converted Spring Boot app is deployed alongside the original Mule app and the same requests are replayed against both, with every response field compared. In our reference conversion, the database endpoints (select, insert, bulk-insert, delete) match the Mule runtime byte-for-byte.

See the worked reference conversion on the Proof page for the actual field-by-field results.

Prove it on your own code

Send us one Mule application and your Postman collection. We convert it and prove the Spring Boot output matches field-by-field — on-premise, inside your environment.