This Spring Boot microservice is designed to work with iTunes media library (tracks, albums and artists).
-
Database initialization
Microservice database can be initialized in two ways.
- Save XML media library form iTunes application;
- Put the XML file in resource folder (
itunes-library-service-impl/src/main/resources/library.xml
); - Enable parsing by setting
itunes-library-service.startup-parsing
to true inapplication.xml
; - Run the application.
- Disable parsing of the file-based library by setting
itunes-library-service.startup-parsing
to false inapplication.xml
; - Create a new database in PostgreSQL, e.g.
itunes-library
with required login and password; - Set URL to the created database in properties, e.g.
spring.datasource.url=jdbc:postgresql://localhost:5432/itunes_library
; - Create new schema inside the specified database, e.g.
library
and set it in properties:spring.jpa.properties.hibernate.default_schema: library
; - Preapre SQL scripts with data t be populated. Current Entity Relation diagram is:
- Save SQL scripts in resource folder (e.g.
resources/sql
) and set paths:
- schema.sql -
spring.datasource.schema=classpath:sql/schema.sql
; - data itself -
spring.datasource.data=classpath:classpath:sql/artists.sql, classpath:sql/albums.sql, classpath:sql/tracks.sql, classpath:sql/trackdiscinfo.sql
;
- Run the application.
The microservice can work with h2 (embedded or file-based) database and PostgreSQL as well. To select a required database type run the application with proper profile (dev-h2 or dev-pg respectively, see application.xml
for more details).
API documentation for running server by default is available here:
- Swagger 2: http://localhost:8081/swagger-ui.html
- OpenAPI 3: http://localhost:8081/api/v1/library/swagger-ui.html