* 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
22 lines
574 B
Java
22 lines
574 B
Java
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;
|
|
}
|
|
}
|