提交 d0922057 编写于 作者: 如梦技术's avatar 如梦技术 🐛

添加对 spring-native 的支持 #38 #I3PX2N

上级 c03724c5
......@@ -33,7 +33,6 @@ dependencyManagement {
dependency "net.dreamlu:mica-qrcode:${VERSION}"
dependency "net.dreamlu:mica-jetcache:${VERSION}"
dependency "net.dreamlu:mica-lite:${VERSION}"
dependency "net.dreamlu:mica-native:${VERSION}"
// commons
dependency "com.google.code.findbugs:jsr305:${findbugsVersion}"
dependency "io.swagger:swagger-annotations:${swaggerAnnotationsVersion}"
......
......@@ -3,6 +3,7 @@ dependencies {
implementation "org.springframework.boot:spring-boot-autoconfigure"
compileOnly "org.springframework:spring-web"
compileOnly "org.springframework.cloud:spring-cloud-context"
compileOnly "org.springframework.experimental:spring-native:${springnativeVersion}"
annotationProcessor "net.dreamlu:mica-auto:${micaAutoVersion}"
testImplementation "org.springframework.boot:spring-boot-starter-test"
}
......@@ -25,6 +25,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.nativex.hint.NativeHint;
import org.springframework.nativex.hint.ResourceHint;
/**
* 验证码自动配置
......@@ -39,6 +41,7 @@ import org.springframework.context.annotation.Configuration;
matchIfMissing = true
)
@EnableConfigurationProperties(MicaCaptchaProperties.class)
@NativeHint(resources = @ResourceHint(patterns = "^fonts/.*.ttf"))
public class MicaCaptchaAutoConfiguration {
@Bean
......
......@@ -2,5 +2,6 @@ dependencies {
api project(":mica-core")
implementation "org.springframework.boot:spring-boot-autoconfigure"
compileOnly "org.springframework.cloud:spring-cloud-context"
compileOnly "org.springframework.experimental:spring-native:${springnativeVersion}"
annotationProcessor "net.dreamlu:mica-auto:${micaAutoVersion}"
}
......@@ -22,6 +22,8 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ResourceLoader;
import org.springframework.nativex.hint.NativeHint;
import org.springframework.nativex.hint.ResourceHint;
/**
* ip2region 自动化配置
......@@ -30,6 +32,7 @@ import org.springframework.core.io.ResourceLoader;
*/
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(Ip2regionProperties.class)
@NativeHint(resources = @ResourceHint(patterns = "^ip2region/ip2region.db"))
public class Ip2regionConfiguration {
@Bean
......
# mica-native 组件
扩展 mica 对 spring-native 的支持。
## 使用
### maven
```xml
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-native</artifactId>
<version>${version}</version>
</dependency>
```
### gradle
```groovy
compile("net.dreamlu:mica-native:${version}")
```
dependencies {
compileOnly "org.springframework.experimental:spring-aot:${springnativeVersion}"
compileOnly "org.springframework.experimental:spring-native:${springnativeVersion}"
}
/*
* Copyright (c) 2019-2029, Dreamlu 卢春梦 (596392912@qq.com & www.dreamlu.net).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dreamlu.mica.nativex.captcha;
import org.springframework.nativex.hint.NativeHint;
import org.springframework.nativex.hint.ResourceHint;
import org.springframework.nativex.type.NativeConfiguration;
/**
* 验证码 spring native 支持
*
* @author L.cm
*/
@NativeHint(resources = @ResourceHint(patterns = "^fonts/.*.ttf"))
public class CaptchaHints implements NativeConfiguration {
}
/*
* Copyright (c) 2019-2029, Dreamlu 卢春梦 (596392912@qq.com & www.dreamlu.net).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dreamlu.mica.nativex.ip2region;
import org.springframework.nativex.hint.NativeHint;
import org.springframework.nativex.hint.ResourceHint;
import org.springframework.nativex.type.NativeConfiguration;
/**
* Ip2Region spring native 支持
*
* @author L.cm
*/
@NativeHint(resources = @ResourceHint(patterns = "^ip2region/ip2region.db"))
public class Ip2RegionHints implements NativeConfiguration {
}
/*
* Copyright (c) 2019-2029, Dreamlu 卢春梦 (596392912@qq.com & www.dreamlu.net).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dreamlu.mica.nativex;
......@@ -17,4 +17,3 @@ include "mica-logging"
include "mica-qrcode"
include "mica-jetcache"
include "mica-lite"
include "mica-native"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册