Backend Development 12 min read

Integrating Dataway with Spring Boot: A Step‑by‑Step Guide

This tutorial explains how to embed Dataway—a zero‑code API configuration UI built on DataQL—into a Spring Boot application by adding Hasor dependencies, configuring properties, setting up required database tables, wiring the data source into Hasor, enabling Hasor annotations, and finally creating and publishing APIs through the Dataway UI.

Java Captain
Java Captain
Java Captain
Integrating Dataway with Spring Boot: A Step‑by‑Step Guide

Dataway is a UI‑based interface configuration tool built on DataQL that lets developers create APIs without writing code; it runs as a jar sharing the same HTTP port as the application.

Step 1 – Add dependencies : include <dependency> <groupId>net.hasor</groupId> <artifactId>hasor-spring</artifactId> <version>4.1.6</version> </dependency> <dependency> <groupId>net.hasor</groupId> <artifactId>hasor-dataway</artifactId> <version>4.1.6</version> </dependency> in the project.

Step 2 – Enable Dataway : add the following properties to application.properties (the two highlighted flags are mandatory): # Enable Dataway HASOR_DATAQL_DATAWAY=true # Enable Dataway admin UI HASOR_DATAQL_DATAWAY_ADMIN=true # Optional settings HASOR_DATAQL_DATAWAY_API_URL=/api/ HASOR_DATAQL_DATAWAY_UI_URL=/interface-ui/ HASOR_DATAQL_FX_PAGE_DIALECT=mysql

Dataway requires two tables; create them with the provided MySQL DDL (tables interface_info and interface_release ).

Step 3 – Configure a datasource : add Druid, MySQL connector and Spring JDBC starter dependencies, then set properties such as: # db spring.datasource.url=jdbc:mysql://xxxxxxx:3306/example spring.datasource.username=xxxxx spring.datasource.password=xxxxx spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.type=com.alibaba.druid.pool.DruidDataSource # druid pool settings spring.datasource.druid.initial-size=3 spring.datasource.druid.min-idle=3 spring.datasource.druid.max-active=10 spring.datasource.druid.max-wait=60000 spring.datasource.druid.stat-view-servlet.login-username=admin spring.datasource.druid.stat-view-servlet.login-password=admin spring.datasource.druid.filter.stat.log-slow-sql=true spring.datasource.druid.filter.stat.slow-sql-millis=1

Step 4 – Register the datasource with Hasor by creating a module: @DimModule @Component public class ExampleModule implements SpringModule { @Autowired private DataSource dataSource = null; @Override public void loadModule(ApiBinder apiBinder) throws Throwable { // DataSource from Spring Boot into Hasor apiBinder.installModule(new JdbcModule(Level.Full, this.dataSource)); } }

Step 5 – Enable Hasor in the Spring Boot entry class : @EnableHasor() @EnableHasorWeb() @SpringBootApplication(scanBasePackages = {"net.example.hasor"}) public class ExampleApplication { public static void main(String[] args) { SpringApplication.run(ExampleApplication.class, args); } }

Step 6 – Run the application and look for Hasor boot logs confirming the API work path ( /api/ ) and admin UI path ( /interface-ui/ ).

Step 7 – Access the UI at http://127.0.0.1:8080/interface-ui/ to manage APIs.

Step 8 – Create a new API : choose SQL or DataQL mode. Example DataQL snippet: var query = @@sql()<% select * from interface_info %> return query() Save, publish (e.g., as GET), and call the endpoint http://127.0.0.1:8080/api/demos to see the result.

In summary, the guide demonstrates how to integrate Dataway into a Spring Boot project, allowing rapid, code‑free API configuration through a unified UI while leveraging Hasor and DataQL.

backend developmentSpring BootAPI ConfigurationDatawayHasor
Java Captain
Written by

Java Captain

Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.