Spring Boot Framework Fresco Play Handson Solutions
1.Accessing values from application.properties file
Hands-on with application.properties file(20 min)
1.1 File Name: application.properties(src/main/resources)
#Put your property here
fresco-course = Spring Boot
- List of Fresco Play Courses without Hands-On | Fresco Play
- HMTL5 Semantics Elements MCQs Answers | Fresco Play
- HMTL5 Semantics Elements Hands-On Solutions | Fresco Play
- Styling with CSS3 Hands-On Solutions | Fresco Play
- Blockchain Intermedio MCQs Answers | Fresco Play
- Blockchain - Potentes Nexus MCQs Answers | Fresco Play
- Azure Essentials MCQs Answers | Fresco Play
- AWS Essentials MCQs Answers | Fresco Play
2.Welcome to Sorting list of objects.
Sorting list of Candidates
Spring Boot Executable(30 min)
2.1 File Name: Employee.java
package com.example.demo.employee;
public class Employee implements Comparable<Employee> {
private String name;
private int age;
private int exp;
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public int getExp() {
return exp;
}
public void setExp(int exp) {
this.exp = exp;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Employee(String name, int age, int exp) {
super();
this.name = name;
this.age = age;
this.exp = exp;
}
public Employee() {
}
@Override
public int compareTo(Employee emp) {
//replace your comparator here
return (this.getAge() - emp.getAge());
}
}
2.2 File Name: EmployeeController.java
package com.example.demo.employee;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
@RestController
public class EmployeeController {
@Autowired
private EmployeeService emp;
@RequestMapping("/")
//Put your code here
public List<Employee> getEmpList(){
//Put your code here
List<Employee> e = emp.getEmployees();
Collections.sort(e);
return e;
}
}
2.3 File Name: EmployeeService.java
package com.example.demo.employee;
import java.util.Arrays;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.ArrayList;
@Service
public class EmployeeService {
public List<Employee> getEmployees() {
//put your code here.
final List<Employee> NB = new ArrayList<>();
NB.add(new Employee("Sandhya",20,0));
NB.add(new Employee("Kemp",24,2));
NB.add(new Employee("Anil",22,3));
NB.add(new Employee("Kumar",30,6));
NB.add(new Employee("Tim",32,7));
return NB;
}
}
3.Welcome to Print the contents of list along with the subList.
My first Spring MVC Application(30 min)
3.1 File Name: ContentController.java
package com.example.demo.content;
import java.util.List;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@RestController
public class ContentController {
//Put your code here.
@Autowired
private ContentService NB;
@RequestMapping("/")
public List<Category> getContentList(){
List<Category> nb = NB.getAllContent();
return nb;
}
}
3.2 File Name: ContentService.java
package com.example.demo.content;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import org.springframework.stereotype.Service;
@Service
public class ContentService {
public List<Category> NBcategories = new ArrayList<>();
//put your code here.
public List<Category> getAllContent() {
List<Course> NBcourse = new ArrayList<>();
NBcourse.add(new Course(1,"NotesBureau",200,200,1001));
NBcourse.add(new Course(1,"NotesBureau",200,200,1001));
NBcourse.add(new Course(1,"NotesBureau",200,200,1001));
List<Category> NBategories = new ArrayList<>();
NBategories.add(new Category(1001,"NotesBureau","Lets teach and learn",NBcourse));
NBategories.add(new Category(1001,"NotesBureau","Lets teach and learn",NBcourse));
NBategories.add(new Category(1001,"NotesBureau","Lets teach and learn",NBcourse));
return NBategories;
}
}
- List of Fresco Play Courses without Hands-On | Fresco Play
- HMTL5 Semantics Elements MCQs Answers | Fresco Play
- HMTL5 Semantics Elements Hands-On Solutions | Fresco Play
- Styling with CSS3 Hands-On Solutions | Fresco Play
- Blockchain Intermedio MCQs Answers | Fresco Play
- Blockchain - Potentes Nexus MCQs Answers | Fresco Play
- Azure Essentials MCQs Answers | Fresco Play
- AWS Essentials MCQs Answers | Fresco Play
Can you please try to give me the solution for spring boot api compatible hands on
ReplyDeleteCan i get solution for spring boot compatible api
ReplyDeletePost a Comment
Any comments and suggestion will be appreciated.