Skip to content
master
Switch branches/tags
Code
This branch is even with PGSSoft:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 

Java Spring PWR 2017 Course Page

Intro

This is the homepage of Java/Spring course organized on Wrocław Uniwersity of Technology by PGS Software in Spring 2017.

Our goal is to go through key aspects of professional development of web application based on the most popular Java web framework - Spring.

After the course, we would like to invite some of you to participate in summer internship program at PGS Software. Do not worry, its paid internship, and you will be able to put your newly acquired knowledge in practice in real-world challenges in renowned software house. Perhaps later you would like to stay with us longer…

Announcement

Homework

Chapter 6

FILL the questionare for chapter 6 in agenda

  • Provide 60% of coverage for source code from previous chapter
  • Write Hamcrest matchers isPresent and isEmpty. First matches when Optional.isPresent() is true, the other when Optional.empty() is true
  • Write Matcher named exchangesFrom that takes a currency as an arugment and matches when CurrencyPair contains 'from currency'`corresponding to matcher's argument
  • Write a method in business-logic-implementation that returns all currency pairs from database. Mock repository so it returns 5 different currency pairs and use exchangeFrom matcher along with hasItem matcher so hasItem(exchangeFrom(PLN)) matches if returned collection contains at least one pair with PLN as base currency

Resources:

Chapter 5

Fill the questionaire for chapter 5 in agenda

  • Modify existing endpoints, that result in a query to fixer.io, to save exchange rates in database. The entry should contain rates of few common currencies to EUR and date.
  • Add a new GET endpoint that will return last entry from database.
  • Add a new PUT endpoint that will save new entry provided in request body in database and return current number of entries.
  • Add a new DELETE endpoint that will remove one entry based on provided id.
  • Add a new POST endpoint expecting body containing currency code and two dates and returning statistics from this period including: (but not limited to) average, minimum and maximum rates to EUR and number of entries.
  • Redesign the database - use two tables instead of one. First should contain id, currency code and name. Second should have id, date, use two foreign keys from first table and store exchange rates between two arbitrary currencies in one entry. Add new endpoints to handle new design. Experiment :)

Resources:

Chapter 4

Fill the questionaire for chapter 4 in agenda

Add to an existing application endpoints that will:

  • Accept GET request with source currency and target currency and return exchange rates based on real data from http://fixer.io/
  • Accept GET request with source currency and multiple target currencies and return rates for each one
  • Do the same, but accept POST request with a JSON body containing those parameters
  • Accept a number between 0 and 1000, source currency and target currency and performs conversion
  • Add date as parameter to present historical results
  • Return some status codes besides "200 OK" and "500 Internal Server Error"

Resources:

Chapter 3

Please also fill in the questionaire attached to description of chapter 3. Fron now on the questionaire will be attached to each chapter

Split existing application into several maven modules with following naming and content:

  • rest client - contains the DemoApplication along with controllers
  • business logic interface - contains technology agnostic interfaces
  • business logic implementation - contains classes implementing interfaces
  • rest client - leave empty for now
  • database - leave empty for now

You may have use of following resources

Chapter 2

Organization

  • The course will start March 7 (Tuesday)
  • The course will consist of eight meetings, carried over six weeks:
  • 07.03.2017
  • 09.03.2017
  • 14.03.2017
  • 16.03.2017
  • 21.03.2017
  • 28.03.2017
  • 04.04.2017
  • 11.04.2017
  • Classes will start at 5pm and last two hours.
  • Classes will take place at Wrocław University of Technology, plac Grunwaldzki 11, 50-377 Wrocław, building D-21, room 201
  • You can contact us via pgscourse@pgs-soft.com
  • At the last class, there will be written exam, mandatory to pass the course.

Prerequisites

  • Basic Java SE skills is the only hard requirement. We would like to focus on how to implement features in given framework, environment, tools, clean code, good practices etc. not the basics of language itself.
  • The lecture / workshop will be in Polish
  • Written materials will be mostly in English

Agenda

Note, that this may be subject to change depending on how fast we will be able to go.

Chapter 1: Introduction

  • Intro, rules and organizational stuff.
  • An overview of the application we will build during the course.

Chapter 2: Tools and environments

Chapter 3: Spring basics

  • Basics of HTTP, request, response, servlets
  • Basics of Java web applications.
  • Application configuration.
  • Spring Boot.
  • Beans, scopes, annotations, factories, contexts.

https://docs.google.com/forms/d/1Enr7B2JxDPIqGDwOajTreTCIimgbtshanfD457UbMKM

Chapter 4: Web Services

  • HTTP methods, Servlets, JSON
  • Web services, REST
  • Processing incoming requests
  • Outgoing requests - RestTemplate
  • Tools – Postman.

https://docs.google.com/forms/d/1OkYfO5MBPqwf3KQmKElG3koCXyxRdYuywJ1FrioBAPw

Chapter 5: Database

  • SQL and relational databases.
  • JPA, Object-Relational Mapping.
  • Spring Data.

https://docs.google.com/forms/d/1_ZXTBJIELdcloLxn3zo4OLvjTH98Ty3uFh5XFRf9Tqw

Chapter 6: Testing

  • Testing basics
  • Junit, unit tests
  • Mockito, mocking frameworks
  • Integration tests

https://docs.google.com/forms/d/1YPj5RAbxR7obPBu1v9hlwYExZg6f_XaTjFVn6kefuqs

Chapter 7: Security, Front-end & Logging

  • Spring Security
  • JHipster frontend
  • Logging frameworks

https://docs.google.com/forms/d/1zzWLu5B29GmQenMjjLigIaXYRUwbMaYaH6VI9qdFQkU

Chapter 8: Error Handling & Advanced Spring

  • HTTP Error codes and Java exceptions
  • Advanced Spring features and more
  • Written exam

Materials

Aside from links in the agenda:

Pluralsight has some good courses. It is paid service, but there is a 30 days free trial:

Project setup

Environment preparation from ground up.

GitHub

Git client / Cloning Repository

MySQL (for Windows)

  • Download MySQL Installer from https://dev.mysql.com/downloads/installer/
  • Run
  • [License Agreement]: Accept, Next
  • [Setup Type]: choose “Developer Default”, Next
  • [Installation]: Execute, Next
  • [Type and Networking]: use default settings, Next
  • [Account and Roles]: choose root password, Next
  • [Windows Service]: choose default settings, Next
  • [Connect To Server]: Check, Next
  • Apply Server Configuration: Execute, Finish

MySQL Workbench (for Windows)

Java JDK

Eclipse / Intellij IDEA

Lombok

  • Download lombok.jar from https://projectlombok.org/download.html
  • Run jar (using “Java (TE) Platform SE Binary” on Windows)
  • If it says it can’t find any IDE on your computer, specify eclipse.exe location -> Install / Update
  • It should add -javaagent:lombok.jar to -vmargs in eclipse.ini and lombok.jar file in Eclipse root folder
  • Restart Eclipse if it’s running

Project Setup

In Eclipse:

  • File -> Import -> Maven-> Existing Maven Projects -> Next
  • Select WeatherForecast as root directory. You should have root pom.xml file displayed and submodules pom.xml underneath. -> Finish.
  • Wait for Importing Maven projects background job to finish
  • Go to Workbench (upper right corner)
  • If there will be Java problems don’t panic
  • Window -> preferences -> Java -> Installed JREs -> Add -> Standard VM -> Directory for Java JDK (not JRE!) -> Finish. Choose jdk from list -> Apply.
  • Root project (WeatherForecast) -> Run as Maven Install, it should output “[INFO] BUILD SUCCESS” at the end
  • If there are still red markers: Project -> Clean
  • Go to com.pgs.ws.rest.Application.java class in rest module, Run as -> Java Application
  • Output should start to appear on console, and at the end, you should get a line like: “ : Started Application in 12.208 seconds (JVM running for 12.852)”

In MySQL Workbench (setup for chapter 5: Database)

  • MySQL Connections -> Local instance MySQL57
  • File -> New query tab
  • Create schema by executing statement: “CREATE DATABASE forecast DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;”
  • Schema name should match property: “spring.datasource.url” in project file: “WeatherForecast\database-access\src\main\resources\application.properties”, in this case “jdbc:mysql://localhost:3306/forecast”
  • Create user by executing statement: “CREATE USER 'username'@'localhost' IDENTIFIED BY userpass;”
  • User name and password should match properties “spring.datasource.username” and “spring.datasource.password” in the same file
  • Grant the new user permissions to schema: “GRANT ALL ON forecast.* TO 'username'@'localhost';”
  • Click refresh in Schemas and select forecast if it’s not visible yet
  • File -> Run SQL script, select script from project: “WeatherForecast\database-access\src\main\resources\sql\mysql\ddl\V0__create_forecast_table.sql”, select forecast schema -> Run

Curl

Postman

About

Java/Spring course organized on Wrocław Uniwersity of Technology by PGS Software in Spring 2017.

Resources

Releases

No releases published

Packages

No packages published

Languages