關於
Inversion Of Control (IOC)- 控制(流程)反轉
- 程式整體的架構流程由開發者轉移到第三方來做控制
什麼是
依賴 (Dependency)- 當一個類別需要實作其他類別時,就是依賴(Dependency) 關係
什麼是
Dependency Injection- 可使類別之間的耦合不那麼緊密
- 對於在類別要使用另外的類別採取注入的方式
- 注入方式可以是用setter取得…等,採取由外部供應
- 建構子注入
- setter注入
- interface注入
- 類別裡不主動實作其他類別
什麼是
POJO什麼是
bean什麼是
JSP什麼是
JPA什麼是
hibernate什麼是
contextConfigLocationcontext-param&init-param區別dispather-servlet.xml&applcationContext.xml差別在儲存
web.xmlloading會很久關於在
Maven Project找不到 Run Server關於
The absolute uri: [http://java.sun.com/jsp/jstl/core] cannot be resolved in either web.xml or the jar files deployed with this application指定 uri: [http://java.sun.com/jsp/jstl/core] 有重複無法解析,刪除多餘的就可以了
關於 Error org.springframework.beans.factory.BeanDefinitionStoreException …ASM ClassReader failed to parse class
JRE 版本跟 Spring版本對不上
關於 Java compiler level does not match
到專案根目錄找
.setting資料夾(隱藏),找org.eclipse.wst.common.project.facet.core.xml修改 java版本關於 Bean property ‘name’ is not readable or has an invalid getter method
沒有設定變數
name的 getter | setter關於 java.lang.ClassNotFoundException: org.springframework.web.WebApplicationInitializer
找不到 WebApplicationInitializer ,是因為用 Maven
- 解決辦法
- 在管理資源,在專案右鍵 -> properties -> Deployment Assembly -> 按下Add
- 選擇 Java Build Path Entries
- 選擇 Maven Dependencies
- Apply
- 參考資料
- 解決辦法
關於 javax.persistence.PersistenceException: No Persistence provider for EntityManager named
因為沒讀到 persistence.xml ,要放在
META-INF資料夾下,資料夾要在Java Build Path>Source下新增關於 WebAppInitializer class 在 Server 啟動時,沒有被實作
- Servlet Container 要支援 Servlet 3.0
- 實作
SpringServletContainerInitializer1
2
3
4
5
6
7
8({WebApplicationInitializer.class})
public class SpringServletContainerInitializer implements ServletContainerInitializer{
public void onStartup(@Nullable Set<Class<?>> webApplicationInitializerClasss, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException{
}
} - 在
src底下新增resources>META-INF>services- 新建檔案
javax.servlet.ServletContainerInitializer - 內容輸入完整的
SpringServletContainerInitializer
- 新建檔案
Q. Server Tomcat v9.0 Server at localhost failed to start.
A. 發現是專案出現 More than one fragment with the name [spring_web] was found. This is not legal …”
Q. 出現 More than one fragment with the name [spring_web] was found. This is not legal …”
A. 在 web.xml 的
web-app加上<absolute-ordering />Q. 什麼是
<absolute-ordering />A. 請參考 https://openhome.cc/Gossip/ServletJSP/Pluggability.html