adding spring controller changes (#493)
* adding spring controller changes * changing package name to baledung * removing test package * adding changes in pom for spring junit testing * adding test classes for controller * adding equals and hashcode for student for test cases * adding changes for running test cases
This commit is contained in:
committed by
Grzegorz Piwowarek
parent
5b3afb4c0d
commit
0f6218ec91
@@ -0,0 +1,21 @@
|
||||
package com.baledung.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baledung.student.Student;
|
||||
|
||||
@RestController
|
||||
public class RestAnnotatedController
|
||||
{
|
||||
@RequestMapping(value="/annotated/student/{studentId}")
|
||||
public Student getData(@PathVariable Integer studentId)
|
||||
{
|
||||
Student student = new Student();
|
||||
student.setName("Peter");
|
||||
student.setId(studentId);
|
||||
|
||||
return student;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user