日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

Spring Spring MVC Hibernate 整合备忘

發布時間:2025/3/17 javascript 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Spring Spring MVC Hibernate 整合备忘 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

以下為此三種框架整合配置的詳細備注,以及部分問題備忘
項目結構和配置文件可訪問 Github 查看

1. pom.xml

盡量使用 Maven 管理項目依賴以減少包引入時的麻煩,以及避免跨開發工具問題

<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/maven-v4_0_0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.ecollaboration</groupId><artifactId>ecollaboration_v1</artifactId><packaging>war</packaging><version>1.0-SNAPSHOT</version><name>ecollaboration_v1 Maven Webapp</name><url>http://maven.apache.org</url><properties><!-- 避免 IDEA 重置編譯配置為 1.5 而提醒版本過時 --><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target><junit.version>4.12</junit.version><spring.version>4.3.3.RELEASE</spring.version><hibernate.version>4.3.11.Final</hibernate.version><jackson.version>2.8.6</jackson.version><commons-fileupload.version>1.3.2</commons-fileupload.version><servlet.version>3.1.0</servlet.version><mysql.jdbc.version>5.1.21</mysql.jdbc.version><aspectj.version>1.8.9</aspectj.version></properties><dependencies><!-- JUnit --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>${junit.version}</version></dependency><!-- Spring 注:引入這一依賴后,spring-context, spring-core 等包會被 Maven 基于依賴管理引入,Spring 中各個包的依賴關系詳見本文參考「1. Spring 各 jar 包的作用及依賴關系」 --><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId><version>${spring.version}</version></dependency><!-- Spring MVC --><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>${spring.version}</version></dependency><!-- Mysql JDBC Driver --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>${mysql.jdbc.version}</version></dependency><!-- Hibernate --><dependency><groupId>org.hibernate</groupId><artifactId>hibernate-core</artifactId><version>${hibernate.version}</version></dependency><!-- Jackson 注:引入 jackson-databind 以便 Spring mvc 對 json、html 等不同返回類型進行配置 --><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>${jackson.version}</version></dependency><!-- Common fileupload 注:用于 Spring mvc 文件上傳 --><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId><version>${commons-fileupload.version}</version></dependency><!-- Servlet API 注:需要使用到 Servlet api 時需要引入這一依賴 --><dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>${servlet.version}</version></dependency><!-- AspectJ 注:Spring 中使用基于 AspectJ 的聲明式 xml 事務配置方式 --><dependency><groupId>org.aspectj</groupId><artifactId>aspectjweaver</artifactId><version>${aspectj.version}</version></dependency></dependencies><build><finalName>ecollaboration_v1</finalName></build> </project>

2. web.xml

<!DOCTYPE web-app PUBLIC"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN""http://java.sun.com/dtd/web-app_2_3.dtd" ><web-app><display-name>Archetype Created Web Application</display-name><!-- Spring 容器初始化配置 --><context-param><param-name>contextConfigLocation</param-name><!-- 此配置指定 Spring 的配置文件為 application-context.xml --><param-value>classpath:application-context.xml</param-value></context-param><!-- 強制 UTF-8 編碼,避免中文亂碼問題。注:如果按照此配置開頭的 web-app_2_3.dtd 規范,filter 配置項必須位于 context-param 和 listener 之間。詳情見參考 14.「The content of element type "web-app" must match 問題之解決辦法」 --><filter><filter-name>characterEncodingFilter</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>UTF-8</param-value></init-param><init-param><param-name>forceEncoding</param-name><param-value>true</param-value></init-param></filter><filter-mapping><filter-name>characterEncodingFilter</filter-name><url-pattern>/</url-pattern></filter-mapping><!-- 使用此配置避免用 new ClassPathXmlApplicationContext("") 的方式得到 Spring 上下文--><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><!-- Spring MVC Servlet --><servlet><servlet-name>spring-mvc-servlet</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><!-- 進行此配置指定 spring mvc 的配置文件為 spring-mvc.xml,否則會默認尋找 xxx-servlet.xml --><init-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring-mvc.xml</param-value></init-param><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>spring-mvc-servlet</servlet-name><url-pattern>/</url-pattern></servlet-mapping></web-app>

3. application-context.xml

文件名與 web.xml 第 12 行匹配

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"xmlns:cache="http://www.springframework.org/schema/cache" xmlns:p="http://www.springframework.org/schema/p"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-4.0.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-4.0.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-4.0.xsdhttp://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.0.xsd"><!-- 引用 jdbc.properties 文件中的配置,該配置會用于 dataSource bean 中 --><context:property-placeholder location="classpath:properties/jdbc.properties" /><!-- 添加 aspectJ 支持 --><aop:aspectj-autoproxy/><!-- 配置 Spring 容器掃描的路徑,這里排除需要載入 Spring MVC 上下文而使用的注解 @Controller。可見參考 15.「spring mvc 和 spring 各自掃描自己的注解不要相互混淆,以及參考 20.「context:exclude-filter 與 context:include-filter」--><context:component-scan base-package="com.ecollaboration"><context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /></context:component-scan><!-- 配置 dataSource bean,這里的 ${jdbc.url} 等對應第 17 行 jdbc.properties 文件中的鍵名 --><bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"><property name="driverClassName" value="${jdbc.driverClassName}"/><property name="url" value="${jdbc.url}"/><property name="username" value="${jdbc.username}"/><property name="password" value="${jdbc.password}"/></bean><!-- 配置 sessionFactory bean,這里用到 dataSource bean --><bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"><property name="dataSource" ref="dataSource"/><!-- 進行部分 hibernate 配置 --><property name="hibernateProperties"><props><!-- 是否打印執行的 SQL 語句 --><prop key="hibernate.show_sql">true</prop><!-- 是否格式化 SQL 語句 --><prop key="hibernate.format_sql">true</prop><!-- 數據庫方言 --><prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop><!-- 自動創建 | 更新 | 驗證數據庫表結構,若這里配置的值為 create,則會在執行 hibernate 表操作時重建表結構( 表會被清空 ) --><prop key="hibernate.hbm2ddl.auto">update</prop><!-- 添加此配置以使用 sessionFactory.getCurrentSession() 得到一個 session --><prop key="current_session_context_class">thread</prop><!-- 添加此配置將事務管理交給 Spring,即無需再寫 session.beginTransaction() 等事務管理和連接資源關閉代碼。參見參考 17.「current_session_context_class」 --><prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate4.SpringSessionContext</prop></props></property><!-- 使用配置文件的方式 --><property name="mappingResources"><list><!-- 引入實體配置 --><value>hibernates/UserEntity.hbm.xml</value></list></property><!-- 使用注解的方式,確定所需掃描的注解所在包的路徑,若僅使用配置的方式,可以注釋這一配置 --><!-- <property name="packagesToScan"><list><value>com.ecollaboration.entities</value></list></property> --></bean><!-- 配置事務管理器 --><bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"><property name="sessionFactory" ref="sessionFactory"/></bean><!-- 配置 AOP Advice --><tx:advice id="txAdvice" transaction-manager="transactionManager"><!-- 添加配置使得符合以下條件的方法會被織入事務管理切面 --><tx:attributes><tx:method name="get*" read-only="true" propagation="REQUIRED"/><tx:method name="list*" read-only="true" propagation="REQUIRED"/><tx:method name="find*" read-only="true" propagation="REQUIRED"/><tx:method name="*" propagation="REQUIRED" rollback-for="Exception"/></tx:attributes></tx:advice><!-- 配置 AOP 切入點,這里使用 AspectJ 的事務配置方式,參見參考 18.「aop:aspectj-autoproxy 作用」,此處的 poincut 屬性需按照實際情況配置 --><aop:config proxy-target-class="true"><aop:advisor pointcut="execution(public * com.ecollaboration.services.*Service.*(..))" advice-ref="txAdvice"/></aop:config> </beans>

4. jdbc.properties

文件名與 application-context.xml 第 17 行匹配

jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost/ecollaboration?characterEncoding=UTF-8 jdbc.username=dbusername jdbc.password=dbpassword

5. spring-mvc.xml

文件名與 web.xml 第 46 行匹配

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsdhttp://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"><!-- 指定 Spring MVC 掃描含有如 @Controller 等注解的包的路徑,一般為項目控制器所在包的路徑。進行這一配置后無需再寫入 <context:component-config />。有關 component-scan 的內容可以參見參考 13.「Spring 注解 @Component、@Repository、@Service、@Controller 區別」。這里使用 include-filter 使得只有含有 @Controller 注解的控制器 bean 會使用 Spring mvc 的上下文,參見參考 19.「在使用 spring mvc 時... @Transactional 聲明的事務不起作用」。--><context:component-scan base-package="com.ecollaboration.controllers"><context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/></context:component-scan><!-- 指定視圖文件后綴和所在的路徑,在控制器的方法中返回的字符串值會表示這一路徑下的同名文件 --><bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"><property name="prefix" value="/WEB-INF/views/"/><property name="suffix" value=".jsp"/></bean><!-- 此配置使得 @ResponseBody 等注解可以生效 --><mvc:annotation-driven/><!-- 此配置使得控制器可以根據返回類型返回 json 數據或視圖文件 --><bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"><property name="order" value="1"/><property name="defaultViews"><list><bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"/></list></property><property name="contentNegotiationManager"><bean class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean"><property name="favorParameter" value="true"/><property name="parameterName" value="format"/><property name="ignoreAcceptHeader" value="false"/><property name="mediaTypes"><value>json=application/jsonxml=application/xmlhtml=text/html</value></property><property name="defaultContentType" value="text/html"/></bean></property></bean><!-- 添加 Spring mvc 的文件上傳支持 --><bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"><property name="maxUploadSize" value="10240000"/><property name="defaultEncoding" value="UTF-8"/></bean><!-- 添加此配置用于排除 Spring mvc 對靜態資源文件的處理。有關靜態資源路徑問題參見參考 31.「Spring mvc 訪問靜態資源的三種方式」 --><mvc:resources mapping="/resources/**" location="/resources/"/><!-- 添加攔截器 --><mvc:interceptors><!-- 全局攔截器,會對所有的請求攔截 --><bean id="normalInterceptor" class="com.ecollaboration.interceptors.NormalInterceptor"/><!-- 局部攔截器,只攔截與 mapping 匹配的請求 --><mvc:interceptor><mvc:mapping path="/hello/register"/><mvc:mapping path="/hello/index/*"/><bean id="testInterceptor" class="com.ecollaboration.interceptors.TestInterceptor"/></mvc:interceptor></mvc:interceptors> </beans>

6. 問題備忘

6.1 JSP 中無法使用 EL 表達式

在 web.xml 中,如果配置信息為:

<!DOCTYPE web-app PUBLIC"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN""http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> </web-app>

則表示其采用 JSP 1.2,EL 表達式默認關閉,此時需要在 .jsp 中添加 <% @page isELIgnored="false" %>;
或采用 JSP 2.0,即將配置信息改為:

<?xml version="1.0" encoding="UTF-8"?> <web-app id="MyApp" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> </web-app>

6.2 /* 與 /** 的區別

/* 中的通配符 * 會止于分隔符 /,而 /** 則不會。如 <url-pattern>/resources/*</url-pattern> 無法匹配 /resources/images/xxx.jpg,而只能匹配 /resources/xxx.jpg。
換做 <url-pattern>/resources/**</url-pattern> 可以解決這一問題。

6.3 路徑問題

在 Java 項目中,/path/to/xxx 表示以 webapp 為起點的路徑;path/to/xxx 表示以項目根目錄為起點的路徑;classpath:path/to/xxx 標識以 classpath 為起點的路徑;
注:也可以使用 this.getClass().getClassLoader().getResource("") 得到類對于系統的絕對路徑進而得到所需資源的路徑。

6.4 classpath: 和 classpath*: 區別

classpath*: 可以從多個 jar 文件中加載相同的文件,而 classpath: 只會加載找到的第一個文件。如引入的兩個 jar 包都存在 com.a 下的 xx.xml 文件,使用 classpath: 只會加載找到的第一個文件,而 classpath*: 則會加載全部。

6.5 class path resource [beans.xml] cannot be opened because it does not exist 報錯解決方法

在 application-context.xml 配置中,關于 sessionFactory 的配置中,其屬性 mappingResource 不能加入 classpath:( 默認即為 classpath 下的文件 ),也不能使用通配符。

<property name="mappingResources"><list><!-- 引入實體配置 --><value>hibernates/UserEntity.hbm.xml</value><!-- 這里不能寫成 --><!-- <value>hibernates/*.hbm.xml</value> --><!-- 也不能寫成 --><!-- <value>classpath:hibernates/UserEntity.hbm.xml</value> --></list> </property>

6.6 Could not obtain transaction-synchronized Session for current thread 報錯解決方法

如果不使用 Spring 的事務管理機制,且使用 session.getCurrentSession() 時,會出現如上圖所示錯誤,此時需要對 application-context (Spring 配置文件)進行更改( 參見 application-context 第 50 行 ):

<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"><!-- ... 其他配置 --> <property name="hibernateProperties"><props><!-- ... 其他配置 --><prop key="current_session_context_class">thread</prop><prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate4.SpringSessionContext</prop><!-- ... 其他配置 --></props></property><!-- ... 其他配置 --> </bean>

并添加配置將事務管理交給 Spring( 參見 application-context 第 90 行 ):

<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"><property name="sessionFactory" ref="sessionFactory"/> </bean><tx:advice id="txAdvice" transaction-manager="transactionManager"><tx:attributes><tx:method name="*" propagation="REQUIRED" rollback-for="Exception"/></tx:attributes> </tx:advice><aop:config proxy-target-class="true"><!-- 與具體包結構有關 --><aop:advisor pointcut="execution(public * com.*(..))" advice-ref="txAdvice"/> </aop:config>

注:需要注意 aop:advisor 中 pointcut 屬性所覆蓋的類與方法,如果操作 session 的方法不在此包含內,則仍會報錯。
注:當然也可以使用 session.openSession() 并通過 Hibernate 的事務管理方式組織代碼。

6.7 Spring MVC 路由失效問題

有時可能出現:在配置了 @Controller 后,訪問該控制器對應的 URL 時,返回 404 錯誤。此時需要檢查 web.xml 中是否添加了 welcome-file-list,如下:

<welcome-file-list> <welcome-file>index.html</welcome-file><welcome-file>index.jsp</welcome-file> </welcome-file-list>

此時,對某一 url 的訪問會等同于訪問該路徑所對應文件夾下的 index.html 或 index.jsp 文件,如訪問 localhost/foo 等同于訪問 localhost/foo/index.html 或 localhost/foo/index.jsp( 依次檢測這兩個文件是否存在 )。因而需要在 spring-mvc.xml ( Spring mvc 配置文件 )中添加如下配置:

<mvc:default-servlet-handler />

6.8 context:property-placeholder 導入多個 .properties 配置文件

由于 Spring 容器允許最多定義一個 placeholder,加入多個文件會忽略。而由于 IDE 不會進行這一判斷,因而會出現 IDE 中沒有警告提示,但運行時卻報錯的情況。

這時我們可以使用通配符解決引入多個配置文件的需求:

<context:property-placeholder location="classpath*:*.properties"/>

6.9 運行出現警告 WARNING: Exception encountered during context initialization - cancelling refresh attempt

發生這一問題可能是由于在進行代碼遷移時,tomcat 和編譯器的 jdk 指定版本不同,導致前者無法識別后者編譯的的字節碼文件。只需將二者保持一致即可,詳情可參考 Stackoverflow。

7. 擴展 - 添加 Thymeleaf 模板引擎支持

若要在項目中使用 Thymeleaf 模板引擎,需要對之前進行的配置進行以下修改

7.1 修改 pom.xml 以增加 Thymeleaf 支持

<!-- 添加 thymeleaf-spring 依賴,會自動引入 thymeleaf 包 --> <dependency><groupId>org.thymeleaf</groupId><artifactId>thymeleaf-spring4</artifactId><version>3.0.3.RELEASE</version> </dependency><!-- 引入 Thymeleaf layout dialect 以使用 layout:fragment 等組織視圖布局。詳情見參考 33. 「Thymeleaf Layout Dialect」 --> <dependency><groupId>nz.net.ultraq.thymeleaf</groupId><artifactId>thymeleaf-layout-dialect</artifactId><version>2.1.2</version> </dependency>

7.2 修改 spring-mvc.xml 以改變 View Resolver

這里需要將 spring-mvc.xml 第 16 - 19 行注釋,并添加 ThymeleafViewResolver 的相應配置:

<!-- 注釋這一段 --><!--<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">--><!--<property name="prefix" value="/WEB-INF/views/"/>--><!--<property name="suffix" value=".jsp"/>--> <!--</bean>--><!-- 添加 ThymeleafViewResolver --><bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver"><!-- 配置視圖所在文件路徑,并指定視圖的文件擴展名 --><property name="prefix" value="/WEB-INF/views/"/><property name="suffix" value=".html"/><property name="templateMode" value="HTML"/><property name="characterEncoding" value="UTF-8"/><!-- 禁用視圖緩存,方便開發階段調試 --><property name="cacheable" value="false"/> </bean><!-- 添加一個新的 bean,用于在使用 layout 組織視圖布局時對 head 中的 css 和 javascript 標簽有序組織 --> <bean id="groupingStrategy" class="nz.net.ultraq.thymeleaf.decorators.strategies.GroupingStrategy"/><bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine"><property name="templateResolver" ref="templateResolver"/><!-- 引入 Layout Dialect 以使用 layout 布局 --><property name="additionalDialects"><set><bean class="nz.net.ultraq.thymeleaf.LayoutDialect"><!-- 傳入上面聲明的 groupingStrategy bean --><constructor-arg ref="groupingStrategy"/></bean></set></property> </bean><bean id="thymeleafViewResolver" class="org.thymeleaf.spring4.view.ThymeleafViewResolver"><property name="templateEngine" ref="templateEngine"/><property name="characterEncoding" value="UTF-8"/> </bean>

7.3 添加 Thymeleaf namespace 支持

由于 Thymeleaf 使用如 <p th:text=""></p> 的方式解析視圖,若要開發工具能夠支持 th:xxx 的代碼提示,需要在 html 標簽中加入聲明:<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">,( 如需使用 layout 布局,還需加入 xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" ),此時 html 文件框架為:

<!doctype html> <html lang="zh-CN" xmlns:th="http://www.thymeleaf.org"xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"> <head><meta charset="UTF-8"><title></title> </head> <body></body> </html>

7.4 在 IDEA 中添加含有 th 命名空間聲明的 .html 文件框架

由于開發工具 與 emmet 插件等自動生成的 .html 文件框架中不含上述聲明,每次都要寫入聲明也比較麻煩,可以在開發工具中添加一個文件模板以避免重復工作,這里以 IDEA 為例:
在 File > Other Settings > Default Settings > Editor > File and Code Templates 中新建一個文件模板,如下圖:

7.5 Thymeleaf 資料參考

  • thymeleaf使用詳解 - 知乎專欄

  • Thymeleaf 模板的使用 - 博客園

  • ${}, *{}, #{}, @{}, ~{} 的區別 - stackoverflow

  • 新一代Java模板引擎Thymeleaf - 天馬營

  • Thymeleaf Layout Dialect


  • 參考

  • Spring 各 jar 包的作用及依賴關系 - 博客園

  • hibernate.hbm2ddl.auto配置詳解 - 博客園

  • Spring-mvc 解決EL表達式不能使用問題 - CSDN

  • Spring: Difference of /* and / with regards to paths - stackoverflow

  • Spring 中 property-placeholder 的使用與解析 - 博客園

  • IDEA 新建 Spring 配置文件的方法 - CSDN

  • SPRING4配置文件模板 - 博客園

  • JAVA獲取CLASSPATH路徑

  • Spring 加載 resource 時 classpath*: 與 classpath: 的區別 - CSDN

  • SSM_config 配置 springmvc.xml 模板 - CSDN

  • <context:component-scan>使用說明 - CSDN

  • java.io.FileNotFoundException: class path resource beans.xml cannot be opened because it does not exist 解決方法 - CSDN

  • Spring 注解 @Component、@Repository、@Service、@Controller 區別 - CSND

  • The content of element type "web-app" must match 問題之解決辦法 - CSDN

  • spring mvc 和 spring 各自掃描自己的注解不要相互混淆 - 博客園

  • context:component-scan 掃描使用上的容易忽略的 use-default-filters - iteye

  • current_session_context_class - CSDN

  • aop:aspectj-autoproxy 作用 - 360DOC

  • 在使用 spring mvc 時,我使用了 @Service 這樣的注解, 發現使用注解 @Transactional 聲明的事務不起作用 - CSDN

  • context:exclude-filter 與 context:include-filter - CSDN

  • SpringMVC + Spring + Hibernate 整合 - 慕課網

  • Spring 事務管理 - 慕課網

  • @resource和@autowired的區別是什么 - CSDN

  • SpringMVC4+thymeleaf3的一個簡單實例(篇二:springMVC與thymeleaf的整合) - 博客園

  • IntelliJ IDEA 2016.3 Help

  • thymeleaf code completion not working intellij 14 - stackoverflow

  • Intellij Idea: Thymeleaf namespace unknown

  • SpringMVC4+thymeleaf3的一個簡單實例(篇二:springMVC與thymeleaf的整合) - 博客園

  • Spring MVC中使用Thymeleaf模板引擎 - 知乎專欄

  • Spring 注解:@Repository、@Service、@Controller、@Autowired - CSDN

  • Spring mvc 訪問靜態資源的三種方式 - CSDN

  • thymeleaf 中文亂碼問題 - CSDN

  • Thymeleaf Layout Dialect - Gitbook

  • spring中 context:property-placeholder 導入多個獨立的配置文件

  • WARNING: Exception encountered during context initialization - cancelling refresh attempt - Stackoverflow

  • 總結

    以上是生活随笔為你收集整理的Spring Spring MVC Hibernate 整合备忘的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。