-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix($starter): correct configuration properties 2
Description: Failed to bind properties under 'maf.configuration' to com.jmsoftware.maf.springcloudstarter.property.MafConfigurationProperties: Reason: java.lang.IllegalStateException: No setter found for property: ignored-url
- Loading branch information
1 parent
2208e18
commit 8820316
Showing
3 changed files
with
26 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
package com.jmsoftware.maf.springcloudstarter.property | ||
|
||
import cn.hutool.core.util.ObjectUtil | ||
import com.jmsoftware.maf.common.util.logger | ||
import com.jmsoftware.maf.springcloudstarter.property.MafConfigurationProperties.IgnoredUrl.Constant.Companion.URL_REGEXP | ||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
|
@@ -19,6 +18,7 @@ import javax.validation.constraints.Pattern | |
* @author Johnny Miller (锺俊), e-mail: [email protected], date: 4/13/22 2:07 PM | ||
**/ | ||
@Validated | ||
@Suppress("unused") | ||
@ConfigurationProperties(prefix = MafConfigurationProperties.PREFIX) | ||
class MafConfigurationProperties { | ||
companion object { | ||
|
@@ -32,7 +32,7 @@ class MafConfigurationProperties { | |
* **ATTENTION**: The value of role name of superuser must be equal to the value that is persistent in database. | ||
**/ | ||
@NotBlank | ||
val superUserRole: String = "admin" | ||
var superUserRole: String = "admin" | ||
|
||
/** | ||
* The role name of guest user (guest) who has restrictions to access any system's resources. Assigning | ||
|
@@ -41,60 +41,56 @@ class MafConfigurationProperties { | |
* **ATTENTION**: The value of role of guest user must be equal to the value that is persistent in database. | ||
**/ | ||
@NotBlank | ||
val guestUserRole: String = "guest" | ||
var guestUserRole: String = "guest" | ||
|
||
/** | ||
* Ignore URLs, used by web access log filter and web security. | ||
**/ | ||
@Valid | ||
val ignoredUrl: IgnoredUrl? = null | ||
lateinit var ignoredUrl: IgnoredUrl | ||
|
||
/** | ||
* Web security feature switch. Default is true. | ||
* true - disable web security; false - enable web security. | ||
**/ | ||
val webSecurityEnabled: Boolean = true | ||
var webSecurityEnabled: Boolean = true | ||
|
||
/** | ||
* Web request log switch. Default is true. | ||
* | ||
* true - disable web request log; false - enable web request log. | ||
**/ | ||
val webRequestLogEnabled: Boolean = true | ||
var webRequestLogEnabled: Boolean = true | ||
|
||
/** | ||
* Included package for http api scan, could be base package | ||
**/ | ||
@NotBlank | ||
val includedPackageForHttpApiScan: String = "" | ||
lateinit var includedPackageForHttpApiScan: String | ||
|
||
@PostConstruct | ||
private fun postConstruct() { | ||
log.warn("Initial bean: `${this.javaClass.simpleName}`") | ||
} | ||
|
||
/** | ||
* Flatten ignored urls string [ ]. | ||
* | ||
* @return the string [ ] | ||
**/ | ||
fun flattenIgnoredUrls(): Array<String?> { | ||
if (ObjectUtil.isNull(ignoredUrl)) { | ||
return arrayOfNulls(0) | ||
} | ||
val flattenIgnoredUrls = mutableListOf<String>() | ||
ignoredUrl?.let { | ||
flattenIgnoredUrls.addAll(it.get) | ||
flattenIgnoredUrls.addAll(it.post) | ||
flattenIgnoredUrls.addAll(it.delete) | ||
flattenIgnoredUrls.addAll(it.put) | ||
flattenIgnoredUrls.addAll(it.head) | ||
flattenIgnoredUrls.addAll(it.patch) | ||
flattenIgnoredUrls.addAll(it.options) | ||
flattenIgnoredUrls.addAll(it.trace) | ||
flattenIgnoredUrls.addAll(it.pattern) | ||
fun flattenIgnoredUrls(): List<String> { | ||
return mutableListOf<String>().let { | ||
it.addAll(ignoredUrl.get) | ||
it.addAll(ignoredUrl.post) | ||
it.addAll(ignoredUrl.delete) | ||
it.addAll(ignoredUrl.put) | ||
it.addAll(ignoredUrl.head) | ||
it.addAll(ignoredUrl.patch) | ||
it.addAll(ignoredUrl.options) | ||
it.addAll(ignoredUrl.trace) | ||
it.addAll(ignoredUrl.pattern) | ||
it | ||
} | ||
return flattenIgnoredUrls.toTypedArray() | ||
} | ||
|
||
@PostConstruct | ||
private fun postConstruct() { | ||
log.warn("Initial bean: `${this.javaClass.simpleName}`") | ||
} | ||
|
||
/** | ||
|