Skip to content

Commit

Permalink
doc(README-week3.md):更新需求二作业说明
Browse files Browse the repository at this point in the history
  • Loading branch information
tanpenggood committed Mar 17, 2021
1 parent 9ece4f7 commit c4a92de
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions docs/README-week3.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,47 @@
[http://localhost:8080/user-web/jolokia/read/com.itplh.projects.user.management:type=User](http://localhost:8080/user-web/jolokia/read/com.itplh.projects.user.management:type=User)
### 需求二
> - 继续完成 Microprofile config API 中的实现
>
> - 扩展 org.eclipse.microprofile.config.spi.ConfigSource 实现,包括 OS 环境变量,以及本地配置文件
>
> - 扩展 org.eclipse.microprofile.config.spi.Converter 实现,提供 String 类型到简单类型
>
> - 通过 org.eclipse.microprofile.config.Config 读取当前应用名称
>
> - 应用名称 property name = “application.name”
1. 扩展`org.eclipse.microprofile.config.spi.ConfigSource`实现
```java
// Program 参数
com.itplh.projects.user.configuration.microprofile.config.source.JavaSystemPropertiesConfigSource
// 本地配置文件
com.itplh.projects.user.configuration.microprofile.config.source.LocalFileConfigSource
// OS 环境变量
com.itplh.projects.user.configuration.microprofile.config.source.OSEnvironmentConfigSource
// ServletContext配置(web.xml)
com.itplh.projects.user.configuration.microprofile.config.source.ServletContextConfigSource
// JNDI配置(context.xml)
com.itplh.projects.user.configuration.microprofile.config.source.JndiConfigSource
```
扩展`org.eclipse.microprofile.config.spi.Converter`实现
```java
com.itplh.projects.user.configuration.microprofile.config.converter.StringToByteConverter
com.itplh.projects.user.configuration.microprofile.config.converter.StringToShortConverter
com.itplh.projects.user.configuration.microprofile.config.converter.StringToIntegerConverter
com.itplh.projects.user.configuration.microprofile.config.converter.StringToLongConverter
com.itplh.projects.user.configuration.microprofile.config.converter.StringToFloatConverter
com.itplh.projects.user.configuration.microprofile.config.converter.StringToDoubleConverter
com.itplh.projects.user.configuration.microprofile.config.converter.StringToBooleanConverter
com.itplh.projects.user.configuration.microprofile.config.converter.StringToCharacterConverter
com.itplh.projects.user.configuration.microprofile.config.converter.StringToStringConverter
```
2. 通过`org.eclipse.microprofile.config.Config`读取当前应用名称
http://localhost:8080/user-web/config/application-name

0 comments on commit c4a92de

Please sign in to comment.