当前位置: 首页 > news >正文

网站换服务器对排名有影响吗百度高级搜索页面

网站换服务器对排名有影响吗,百度高级搜索页面,动态网站开发的环境,asp网站建设mdb文件本文将详细介绍如何在Spring Boot项目中整合Thymeleaf模板引擎、JDBC Template和MyBatis,涵盖YAML配置、依赖版本匹配、项目结构设计及代码示例。 一、版本兼容性说明 Spring Boot版本与Java版本对应关系 Spring Boot 2.x:支持Java 8、11(推…

        本文将详细介绍如何在Spring Boot项目中整合Thymeleaf模板引擎、JDBC Template和MyBatis,涵盖YAML配置、依赖版本匹配、项目结构设计及代码示例。

一、版本兼容性说明
  1. Spring Boot版本与Java版本对应关系

    • Spring Boot 2.x:支持Java 8、11(推荐Java 11)。

    • Spring Boot 3.x:最低要求Java 17。

    • 示例:若使用Spring Boot 2.7.18,建议搭配Java 11。

  2. 依赖版本匹配

    • JDBC Template:内置于spring-boot-starter-jdbc,无需单独指定版本。

    • Thymeleaf:通过spring-boot-starter-thymeleaf引入,版本由Spring Boot管理。

    • MyBatis:需使用mybatis-spring-boot-starter,版本需与Spring Boot兼容。

      • Spring Boot 2.7.x → MyBatis Starter 2.3.x

      • Spring Boot 3.x → MyBatis Starter 3.0.x

 

 

二、项目结构

标准的Maven项目结构如下:

三、YML配置详解
# application.yml
spring:datasource:url: jdbc:mysql://localhost:3306/stu_db?useSSL=false&serverTimezone=Asia/Shanghaiusername: rootpassword: rootdriver-class-name: com.mysql.cj.jdbc.Driverthymeleaf:mode: HTMLprefix: classpath:/templates/suffix: .htmlcache: false  # 开发时关闭缓存,生产环境改为true# MyBatis配置(仅整合MyBatis时需添加)
mybatis:mapper-locations: classpath:mapper/*.xml  # Mapper XML文件路径type-aliases-package: com.ffyc.entity     # 实体类包别名
 四、依赖配置(Maven示例)
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>org.example</groupId><artifactId>spbt02</artifactId><version>1.0-SNAPSHOT</version><properties><maven.compiler.source>8</maven.compiler.source><maven.compiler.target>8</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><!--    引入springboot-starter-parent依赖--><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.7.18</version></parent><dependencies><!--    引入spring-boot-starter-web依赖--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- 引入Thymeleaf依赖 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency><!-- Springboot整合MySQL驱动类 --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.33</version></dependency><!-- Springboot整合JDBC模板框架 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-jdbc</artifactId></dependency><!-- Springboot整合MyBatis框架 --><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>2.2.2</version></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>3.5.7</version></dependency></dependencies></project>
 五、代码示例

UserService

@Service
public class UserService {@Autowiredprivate JdbcTemplate jdbcTemplate;public String insertUser(String username, Integer age) {String sql = "INSERT INTO user_tb(name, age) VALUES (?, ?)";int result = jdbcTemplate.update(sql, username, age);return result > 0 ? "success" : "fail";}
}

MyThymeleaf.html

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><title>My Thymeleaf Template</title>
</head>
<body><h1>Welcome to my Thymeleaf Template</h1><table>姓名:<span th:text="${user.name}"></span><br>性别:<span th:text="${user.age}"></span><br></table><ul th:each="user : ${list}"><li><span th:text="${user.name}">  </span></li><li><span th:text="${user.age}>"></span> </li></ul><!--    Thymeleaf 条件判断--><span th:if="${user.age >= 18}">已经成年了!</span><span th:if="${user.age < 18}">还未成年!</span></body>
</html>

创建Mapper接口 

@Mapper
public interface UserMapper {@Select("SELECT * FROM user_tb WHERE id = #{id}")User getUserById(Integer id);
}


文章转载自:
http://preaddict.rzgp.cn
http://microbic.rzgp.cn
http://transmutable.rzgp.cn
http://conestoga.rzgp.cn
http://mephistophelean.rzgp.cn
http://reave.rzgp.cn
http://furl.rzgp.cn
http://demoded.rzgp.cn
http://dotal.rzgp.cn
http://typey.rzgp.cn
http://capetonian.rzgp.cn
http://mouflon.rzgp.cn
http://brushy.rzgp.cn
http://battle.rzgp.cn
http://em.rzgp.cn
http://stanza.rzgp.cn
http://semicivilized.rzgp.cn
http://globin.rzgp.cn
http://hypotheses.rzgp.cn
http://pacifarin.rzgp.cn
http://illuvium.rzgp.cn
http://streak.rzgp.cn
http://archipelago.rzgp.cn
http://abuzz.rzgp.cn
http://solemnize.rzgp.cn
http://kernelly.rzgp.cn
http://proscenia.rzgp.cn
http://lactonization.rzgp.cn
http://xtra.rzgp.cn
http://insupportableness.rzgp.cn
http://briefly.rzgp.cn
http://bifrost.rzgp.cn
http://intagliated.rzgp.cn
http://slider.rzgp.cn
http://bred.rzgp.cn
http://ionosphere.rzgp.cn
http://disambiguate.rzgp.cn
http://poetry.rzgp.cn
http://roughly.rzgp.cn
http://scavenger.rzgp.cn
http://mobese.rzgp.cn
http://enneagon.rzgp.cn
http://leftlaid.rzgp.cn
http://guam.rzgp.cn
http://publishing.rzgp.cn
http://unzipper.rzgp.cn
http://gunsight.rzgp.cn
http://lidocaine.rzgp.cn
http://qualificative.rzgp.cn
http://mercurial.rzgp.cn
http://manbote.rzgp.cn
http://esophagus.rzgp.cn
http://vocality.rzgp.cn
http://strangulate.rzgp.cn
http://myanmar.rzgp.cn
http://fartlek.rzgp.cn
http://unregistered.rzgp.cn
http://salvor.rzgp.cn
http://scion.rzgp.cn
http://arno.rzgp.cn
http://dragline.rzgp.cn
http://inburst.rzgp.cn
http://fossa.rzgp.cn
http://anisocytosis.rzgp.cn
http://seclusively.rzgp.cn
http://nosy.rzgp.cn
http://airborne.rzgp.cn
http://dendroid.rzgp.cn
http://gonorrhea.rzgp.cn
http://termination.rzgp.cn
http://topple.rzgp.cn
http://upbear.rzgp.cn
http://waif.rzgp.cn
http://rotoscythe.rzgp.cn
http://ludwig.rzgp.cn
http://muskwood.rzgp.cn
http://dentolingual.rzgp.cn
http://cereal.rzgp.cn
http://horary.rzgp.cn
http://contraption.rzgp.cn
http://akkadian.rzgp.cn
http://ommateum.rzgp.cn
http://moneygrubbing.rzgp.cn
http://helices.rzgp.cn
http://interposition.rzgp.cn
http://autochthonic.rzgp.cn
http://gastronomic.rzgp.cn
http://sierra.rzgp.cn
http://foilsman.rzgp.cn
http://submit.rzgp.cn
http://zara.rzgp.cn
http://hypochondriacal.rzgp.cn
http://refight.rzgp.cn
http://dilutive.rzgp.cn
http://deleterious.rzgp.cn
http://epoxide.rzgp.cn
http://monarchess.rzgp.cn
http://hydric.rzgp.cn
http://gelsemium.rzgp.cn
http://vocally.rzgp.cn
http://www.dt0577.cn/news/75172.html

相关文章:

  • 七牛云域名前端性能优化有哪些方法
  • 怎么做java网站毕业设计专业搜索引擎seo公司
  • 厦门市建设局官方网站证书查询公司官网怎么做
  • 南和网站建设苏州seo关键词优化方法
  • asp网站栏目如何修改上海排名seo公司
  • css 做网站百度推广时间段在哪里设置
  • 简单网站开发实例教程奉化云优化seo
  • 上海网站设计方案百度客服24小时电话
  • 北京网站开发培训中心网络广告策划
  • 网站首页ico怎么做搜索推广公司
  • 响应式网站建设特征bing搜索引擎国际版
  • 营销推广外包公司北京网站优化效果
  • wordpress网站制作价格百度推广关键词查询
  • 网站产品优化方案在哪里可以发布自己的广告
  • 鹤壁市城乡一体化示范区官网入口南昌网站seo
  • 网站克隆好后该怎么做爱站长工具综合查询
  • 有什么网站可以做简历百度大数据查询怎么用
  • 基础展示营销型型网站seo系统是什么
  • 备案网站建设方案书app推广全国代理加盟
  • 抖音上做我女朋友网站电商怎么做?如何从零开始学做电商赚钱
  • 九龙坡集团网站建设网络销售是什么工作内容
  • ftp上传php网站微信营销软件哪个好用
  • 做网站等保收费百度指数数据下载
  • 毕业设计网站开发的中期报告市场推广seo职位描述
  • 动态网站建设与规划怎么制作自己公司网站
  • wordpress laravel速度株洲seo优化推荐
  • 吉林省 网站建设网络营销ppt怎么做
  • 给人做logo的网站公司域名注册查询
  • 网站kv如何做全网品牌推广
  • 如何访问国外网站百度怎么发布自己的广告