Giter Club home page Giter Club logo

externalized-query-example's Introduction

Externalized Query Example

This project employs Spring Boot and Spring Data JPA to demonstrate how to successfully read and execute a SQL statement by key from a properties file.

Prerequisites

  • Java JDK 1.8u141
  • Gradle 4.1

How to compile and run unit tests

gradle test

How to publish artifact to local Maven repository

The build.gradle file includes the maven-publish plugin which allows you to execute

gradle publishToMavenLocal

This will publish the artifact and a POM file to your .m2/repository directory in a {groupId}/{artifactId}/{version} sub-directory.

Details

This project employs Lombok so we can annotate instead of writing what amounts to boilerplate code.

We annotate CourseQueries with ConfigurationProperties to encapsulate a namespace of sql.course queries found in application.yml

We define CourseRepository and have it extend the CrudRepository interface. We also define an additional query method using conventions.

We implement CourseService to demonstrate how to employ a JdbcTemplate to execute a query

Finally we author a unit test for the aformentioned service. (Spring Boot Test is helpful).

An in-memory database is initialized on startup.

Credits

externalized-query-example's People

Contributors

pacphi avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.