简单简历项目基于springboot

eduation类

public class Eduation {

    private String degree;
    private String institution;
    private String yearOfGraduation;

    // Getters and Setters

    public String getDegree() {
        return degree;
    }

    public void setDegree(String degree) {
        this.degree = degree;
    }

    public String getInstitution() {
        return institution;
    }

    public void setInstitution(String institution) {
        this.institution = institution;
    }

    public String getYearOfGraduation() {
        return yearOfGraduation;
    }

    public void setYearOfGraduation(String yearOfGraduation) {
        this.yearOfGraduation = yearOfGraduation;
    }

    // Optional: Override toString for better readability
    @Override
    public String toString() {
        return "Education{" +
                "degree='" + degree + '\'' +
                ", institution='" + institution + '\'' +
                ", yearOfGraduation='" + yearOfGraduation + '\'' +
                '}';
    }
}

experience类

package com.example.jianli1;

public class Experience {
    private String jobTitle;
    private String companyName;
    private String duration;
    private String description;

    // Getters and setters omitted for brevity
    public String getJobTitle() {
        return jobTitle;
    }

    public void setJobTitle(String jobTitle) {
        this.jobTitle = jobTitle;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getDuration() {
        return duration;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    // Optional: Override toString for better readability
    @Override
    public String toString() {
        return "Experience{" +
                "jobTitle='" + jobTitle + '\'' +
                ", companyName='" + companyName + '\'' +
                ", duration='" + duration + '\'' +
                ", description='" + description + '\'' +
                '}';
    }
}


resume类

package com.example.jianli1;

import java.util.List;

public class Resume {
    private String name;
    private String email;
    private String phone;
    private String profileSummary;
    private List<String> skills;
    private List<Experience> experiences;
    private List<Eduation> educationList;

    // Getters and setters omitted for brevity
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getProfileSummary() {
        return profileSummary;
    }

    public void setProfileSummary(String profileSummary) {
        this.profileSummary = profileSummary;
    }

    public List<String> getSkills() {
        return skills;
    }

    public void setSkills(List<String> skills) {
        this.skills = skills;
    }

    public List<Experience> getExperiences() {
        return experiences;
    }

    public void setExperiences(List<Experience> experiences) {
        this.experiences = experiences;
    }

    public List<Eduation> getEducationList() {
        return educationList;
    }

    public void setEducationList(List<Eduation> educationList) {
        this.educationList = educationList;
    }

    // Optional: Override toString for better readability
    @Override
    public String toString() {
        return "Resume{" +
                "name='" + name + '\'' +
                ", email='" + email + '\'' +
                ", phone='" + phone + '\'' +
                ", profileSummary='" + profileSummary + '\'' +
                ", skills=" + skills +
                ", experiences=" + experiences +
                ", educationList=" + educationList +
                '}';
    }

}

 ResumeController类
package com.example.jianli1;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Arrays;

@Controller
public class  ResumeController {

    @GetMapping("/resume")
    public String getResume(Model model) {
        Resume resume = new Resume();
        resume.setName("John Doe");
        resume.setEmail("john.doe@example.com");
        resume.setPhone("+123456789");
        resume.setProfileSummary("A passionate software engineer with 5 years of experience in developing web applications.");

        resume.setSkills(Arrays.asList("Java", "Spring Boot", "Thymeleaf", "JavaScript", "SQL"));

        Experience experience1 = new Experience();
        experience1.setJobTitle("Software Engineer");
        experience1.setCompanyName("Tech Company");
        experience1.setDuration("2019 - Present");
        experience1.setDescription("Developed and maintained web applications using Spring Boot and JavaScript.");

        Experience experience2 = new Experience();
        experience2.setJobTitle("Junior Developer");
        experience2.setCompanyName("Startup Inc.");
        experience2.setDuration("2017 - 2019");
        experience2.setDescription("Assisted in building APIs and worked on front-end using HTML, CSS, and JavaScript.");

        resume.setExperiences(Arrays.asList(experience1, experience2));

        Eduation education1 = new Eduation();
        education1.setDegree("Bachelor of Computer Science");
        education1.setInstitution("XYZ University");
        education1.setYearOfGraduation("2017");

        resume.setEducationList(Arrays.asList(education1));

        model.addAttribute("resume", resume);
        return "resume";
    }
}

运行类

package com.example.jianli1;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Jianli1Application {

	public static void main(String[] args) {
		SpringApplication.run(Jianli1Application.class, args);
	}

}

html

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Resume - {{ resume.name }}</title>
</head>
<body>
<h1>{{ resume.name }}'s Resume</h1>

<h2>Contact Information</h2>
<p>Email: {{ resume.email }}</p>
<p>Phone: {{ resume.phone }}</p>

<h2>Profile Summary</h2>
<p>{{ resume.profileSummary }}</p>

<h2>Skills</h2>
<ul>
    <li th:each="skill : ${resume.skills}" th:text="${skill}"></li>
</ul>

<h2>Experience</h2>
<div th:each="exp : ${resume.experiences}">
    <h3 th:text="${exp.jobTitle}"></h3>
    <p th:text="${exp.companyName}"></p>
    <p th:text="${exp.duration}"></p>
    <p th:text="${exp.description}"></p>
</div>

<h2>Education</h2>
<div th:each="edu : ${resume.educationList}">
    <p th:text="${edu.degree}"></p>
    <p th:text="${edu.institution}"></p>
    <p th:text="${edu.yearOfGraduation}"></p>
</div>
</body>
</html>

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>3.3.5</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.example</groupId>
	<artifactId>jianli1</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>jianli1</name>
	<description>Demo project for Spring Boot</description>
	<url/>
	<licenses>
		<license/>
	</licenses>
	<developers>
		<developer/>
	</developers>
	<scm>
		<connection/>
		<developerConnection/>
		<tag/>
		<url/>
	</scm>
	<properties>
		<java.version>17</java.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>6.1.14</version>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-thymeleaf</artifactId>
		</dependency>


	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

</project>
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

没有它打开页面会报错

结果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值