Code Monkey home page Code Monkey logo

spring-music's Introduction

Spring Music

This is a sample application for using Spring Framework and Spring Boot.

This application has been built to store the same domain objects in one of a variety of different persistence technologies - relational, document, and key-value stores. This is not meant to represent a realistic use case for these technologies, since you would typically choose the one most applicable to the type of data you need to store.

The application uses Spring Java configuration and bean profiles to configure the application and the connection objects needed to use the persistence stores.

Building

This project requires a Java version between 8 and 17 to compile.

To build a runnable Spring Boot jar file, run the following command:

$ ./gradlew clean assemble

Running the application locally

One Spring bean profile should be activated to choose the database provider that the application should use. The profile is selected by setting the system property spring.profiles.active when starting the app.

The application can be started locally using the following command:

$ java -jar -Dspring.profiles.active=<profile> build/libs/spring-music.jar

where <profile> is one of the following values:

  • mysql
  • postgres
  • mongodb
  • redis

If no profile is provided, an in-memory relational database will be used. If any other profile is provided, the appropriate database server must be started separately. Spring Boot will auto-configure a connection to the database using it's auto-configuration defaults. The connection parameters can be configured by setting the appropriate Spring Boot properties.

If more than one of these profiles is provided, the application will throw an exception and fail to start.

Alternate Java versions

By default, the application will be built and deployed using Java 8 compatibility. If you want to use a more recent version of Java, you will need to update two things.

In build.gradle, change the targetCompatibility Java version:

java {
  ...
  targetCompatibility = JavaVersion.VERSION_1_8
}

Set targetCompatibility to JavaVersion.VERSION_11 for Java 11 or JavaVersion.VERSION_17 for Java 17.

Exercise

You can find the description to the exercise here

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.