spring boot 开发相关
来源:互联网 发布:听东方软件 编辑:程序博客网 时间:2024/04/28 12:16
转载请注明出处。
用了spring boot有一段时间了,中途也遇到过一些坑.下面记录一下:
刚开始使用eclipse做开发,但是对于做android的我来说,eclipse很久不用了,最主要的是eclipse需要自己安装gradle,然后将web项目转成gradle项目.太麻烦了.鉴于spring boot内置tomcat,本身就是一个java程序,所以果断使用android studio进行开发.
以下有几个点需要注意:
目录结构:src/main下面一个java目录存放代码,另一个resources目录存放资源.(当然最主要的build.gradle要正确配置)
使用的hibernate.cfg.xml文件内容,此处使用mysql:
<?xml version='1.0' encoding='utf-8'?><!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"><hibernate-configuration> <session-factory> <!-- Database connection settings --> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://localhost:3306/m_c</property> <property name="connection.username">thy</property> <property name="connection.password">******</property> <!-- SQL dialect --> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <!-- Echo all executed SQL to stdout --> <property name="show_sql">true</property> <property name="format_sql">true</property> <!-- Drop and re-create the database schema on startup --> <property name="hbm2ddl.auto">update</property> <mapping class="com.thy.model.User" /> </session-factory></hibernate-configuration>
3 . 关于jsp模板代码,代码置于resources/templates目录下,其他的css,js,图片等放到静态资源目录下,默认的资源目录
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = { "classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/" };
优先级顺序为:META/resources > resources > static > public
4 . 要使用html模板,需要引入以下模块
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
暂时先写到这,以后在慢慢整理
0 0
- spring boot 开发相关
- Spring Boot相关概述
- spring boot相关
- Spring boot 项目相关
- Spring Boot相关知识
- spring-boot事务相关
- spring boot相关
- spring boot web相关配置
- spring boot web相关配置
- Spring Boot WEB相关配置
- spring boot mybatis相关问题
- spring boot web相关配置
- spring boot的相关配置
- Spring Boot (五) Repository相关
- Spring Boot (七) 异常相关
- Spring Boot (八) 相关配置
- Spring Boot + mybatis 开发
- Spring Boot 开发入门
- iOS学习路线图
- 提取胡数据通过区分管道号分类
- LeetCode-347.Top K Frequent Elements
- mesos解读
- 蓝桥杯2016决赛 凑平方数
- spring boot 开发相关
- jQuery搭建简单的瀑布流页面
- 浏览器跨域访问解决方案
- Button覆盖ListView接收点击事件的解决办法
- Android最佳性能实践(四)——布局优化技巧
- Small 语法转 JAVA
- #2 – Rendering Tiers(WPF渲染级别)
- iOS - Runtime 获取属性列表 方法列表 成员变量列表 协议列表
- 如何提高码农产量,基于ASP.NET MVC的敏捷开发框架开发随笔一