Java Spring 官方已提供2.6.6 可以修補 Java Spring RCE 的Zero Day。
修補方式即是在 pom.xml 檔案中的版本調整到2.6.6 以上即可。
<?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.6.6</version> <relativePath /> <!-- lookup parent from repository --> </parent> </project>
然而因本身專案專案由舊版本升級可能會出現一些版本變更需進行之調整。
針對2.5.3 升級至 2.6.6 所面臨到的幾個問題與調整方式如下:
application.properties
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2019Dialect spring.jpa.database-platform=org.hibernate.dialect.SQLServerDialect
然而java spring 2.6版本並不允許 bean 出現循環引用的結構,故若由2.6之前的版本升級到2.6以後的版本時可能會因專案開發與規劃未注意而發生循環結構無法啟動之問題。
Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.
當然建議是修改程式架構進而解除此狀況,但一般系統可能有時程壓力,若來不及調整急需升級上限則可以透過設定檔,允許循環結構的使用。
設定如下:
application.properties
spring.main.allow-circular-references=true
文章標籤
全站熱搜