August 2017
Intermediate to advanced
332 pages
9h 16m
English
The first version of the calculator will be able to add two numbers. Let's add the business logic as a class in the src/main/java/com/leszko/calculator/Calculator.java file:
package com.leszko.calculator;import org.springframework.stereotype.Service;@Servicepublic class Calculator { int sum(int a, int b) { return a + b; }}
To execute the business logic, we also need to add the web service controller in a separate file src/main/java/com/leszko/calculator/CalculatorController.java:
package com.leszko.calculator;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.bind.annotation.RestController; ...
Read now
Unlock full access