SpringBoot2==通过IDEA创建springboot官方文档中的宠物医院项目petclinic

        最近看spring官方文档,很多地方将一个宠物医院项目作为示例,搜了下网上源码,从github拉下来之后按照官方文档说明也能执行,但是还配置了docker啥的,还有前端样式通过less,全是用的spring自己的相关技术,如JPA、thymeleaf、validate,不是很方便我自己看,所以自己根据源码改了改方便以后看。

        原项目地址和文档:

Spring Petclinichttps://projects.spring.io/spring-petclinic/GitHub - githubdrk/spring-petclinic: A sample Spring-based applicationhttps://github.com/githubdrk/spring-petclinic==============================================================

跑了一遍算是摸清楚了这个项目的功能:

1、这个系统是给医院管理人员使用的,但是不需要账号密码登录

2、能够记录哪些客人将宠物送到了这个医院医治

3、能够查看修改新增 宠物被探望的记录

4、能够查看修改新增客人信息

5、能够查看修改新增客人送过来的宠物的信息,比如A客人送来了两只宠物,可以编辑两只宠物的年龄种类所属人等信息。

根据源码,适当简化后实现出来的效果

建表sql官方也提供了:

 

 

 

 

 

 

 项目结构:

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>2.5.6</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo-jpa</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo-jpa</name>
    <description>demo-jpa</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <!--数据源和连接池和JPA简化CRUD,JPA类似mybatisPlus-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.2.8</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <!--提供一些注解如@controller@RequestMapping处理请求和响应-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!--spring提供的模板引擎,想成JSP就行了,差不多的道理,可以直接用${}获取域对象的中数据-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

        <!--校验-->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>7.0.1.Final</version>
        </dependency>

        <!-- caching -->
        <dependency>
            <groupId>javax.cache</groupId>
            <artifactId>cache-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ehcache</groupId>
            <artifactId>ehcache</artifactId>
        </dependency>
        <!--测试-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

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

</project>

 完整项目代码:李nn/demo-jpahttps://gitee.com/hebian1994/demo-jpa.git

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值