面試官:你經(jīng)常在SpringBoot中使用的條件注解底層是如何實(shí)現(xiàn)的?你了解過嗎亲铡?

面試官:你經(jīng)常在SpringBoot中使用的條件注解底層是如何實(shí)現(xiàn)的才写?你了解過嗎葡兑?

SpringBoot內(nèi)部提供了特有的注解:條件注解(Conditional Annotation)。比如@ConditionalOnBean赞草、@ConditionalOnClass讹堤、@ConditionalOnExpression、@ConditionalOnMissingBean等厨疙。


條件注解存在的意義在于動態(tài)識別(也可以說是代碼自動化執(zhí)行)洲守。比如@ConditionalOnClass會檢查類加載器中是否存在對應(yīng)的類,如果有的話被注解修飾的類就有資格被Spring容器所注冊沾凄,否則會被skip梗醇。


比如FreemarkerAutoConfiguration這個(gè)自動化配置類的定義如下:

@Configuration@ConditionalOnClass({ freemarker.template.Configuration.class, ???FreeMarkerConfigurationFactory.class })@AutoConfigureAfter(WebMvcAutoConfiguration.class)@EnableConfigurationProperties(FreeMarkerProperties.class)public class FreeMarkerAutoConfiguration ???


這個(gè)自動化配置類被@ConditionalOnClass條件注解修飾,這個(gè)條件注解存在的意義在于判斷類加載器中是否存在freemarker.template.Configuration和FreeMarkerConfigurationFactory這兩個(gè)類撒蟀,如果都存在的話會在Spring容器中加載這個(gè)FreeMarkerAutoConfiguration配置類叙谨;否則不會加載。


# 條件注解內(nèi)部的一些基礎(chǔ)


在分析條件注解的底層實(shí)現(xiàn)之前保屯,我們先來看一下這些條件注解的定義手负。以@ConditionalOnClass注解為例,它的定義如下:

@Target({ ElementType.TYPE, ElementType.METHOD })@Retention(RetentionPolicy.RUNTIME)@Documented@Conditional(OnClassCondition.class)public @interface ConditionalOnClass { ?Class<?>[] value() default {}; // 需要匹配的類 ?String[] name() default {}; // 需要匹配的類名} ???


它有2個(gè)屬性姑尺,分別是類數(shù)組和字符串?dāng)?shù)組(作用一樣竟终,類型不一樣),而且被@Conditional注解所修飾股缸,這個(gè)@Conditional注解有個(gè)名為values的Class[]類型的屬性。 這個(gè)Condition是個(gè)接口吱雏,用于匹配組件是否有資格被容器注冊敦姻,定義如下:

public interface Condition { ?// ConditionContext內(nèi)部會存儲Spring容器、應(yīng)用程序環(huán)境信息歧杏、資源加載器镰惦、類加載器 ?boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata);} ???


也就是說@Conditional注解屬性中可以持有多個(gè)Condition接口的實(shí)現(xiàn)類,所有的Condition接口需要全部匹配成功后這個(gè)@Conditional修飾的組件才有資格被注冊犬绒。


Condition接口有個(gè)子接口ConfigurationCondition:


public interface ConfigurationCondition extends Condition {??ConfigurationPhase getConfigurationPhase();??public static enum ConfigurationPhase {????PARSE_CONFIGURATION,????REGISTER_BEAN ?}} ???


這個(gè)子接口是一種特殊的條件接口旺入,多了一個(gè)getConfigurationPhase方法,也就是條件注解的生效階段凯力。只有在ConfigurationPhase中定義的兩種階段下才會生效茵瘾。


Condition接口有個(gè)實(shí)現(xiàn)抽象類SpringBootCondition,SpringBoot中所有條件注解對應(yīng)的條件類都繼承這個(gè)抽象類咐鹤。它實(shí)現(xiàn)了matches方法:


@Overridepublic final boolean matches(ConditionContext context, ???AnnotatedTypeMetadata metadata) { ?String classOrMethodName = getClassOrMethodName(metadata); // 得到類名或者方法名(條件注解可以作用的類或者方法上) ?try { ???ConditionOutcome outcome = getMatchOutcome(context, metadata); // 抽象方法拗秘,具體子類實(shí)現(xiàn)。ConditionOutcome記錄了匹配結(jié)果boolean和log信息 ???logOutcome(classOrMethodName, outcome); // log記錄一下匹配信息 ???recordEvaluation(context, classOrMethodName, outcome); // 報(bào)告記錄一下匹配信息 ???return outcome.isMatch(); // 返回是否匹配 ?} ?catch (NoClassDefFoundError ex) { ???throw new IllegalStateException( ???????"Could not evaluate condition on " + classOrMethodName + " due to " ???????????+ ex.getMessage() + " not " ???????????+ "found. Make sure your own configuration does not rely on " ???????????+ "that class. This can also happen if you are " ???????????+ "@ComponentScanning a springframework package (e.g. if you " ???????????+ "put a @ComponentScan in the default package by mistake)", ???????ex); ?} ?catch (RuntimeException ex) { ???throw new IllegalStateException( ???????"Error processing condition on " + getName(metadata), ex); ?}} ???


# 基于Class的條件注解


SpringBoot提供了兩個(gè)基于Class的條件注解:@ConditionalOnClass(類加載器中存在指明的類)或者@ConditionalOnMissingClass(類加載器中不存在指明的類)祈惶。


@ConditionalOnClass或者@ConditionalOnMissingClass注解對應(yīng)的條件類是OnClassCondition雕旨,定義如下:


@Order(Ordered.HIGHEST_PRECEDENCE) // 優(yōu)先級扮匠、最高級別class OnClassCondition extends SpringBootCondition {??@Override ?public ConditionOutcome getMatchOutcome(ConditionContext context, ?????AnnotatedTypeMetadata metadata) {????StringBuffer matchMessage = new StringBuffer(); // 記錄匹配信息????MultiValueMap<String, Object> onClasses = getAttributes(metadata, ???????ConditionalOnClass.class); // 得到@ConditionalOnClass注解的屬性 ???if (onClasses != null) { // 如果屬性存在 ?????List<String> missing = getMatchingClasses(onClasses, MatchType.MISSING, ?????????context); // 得到在類加載器中不存在的類 ?????if (!missing.isEmpty()) { // 如果存在類加載器中不存在對應(yīng)的類,返回一個(gè)匹配失敗的ConditionalOutcome ???????return ConditionOutcome ???????????.noMatch("required @ConditionalOnClass classes not found: " ???????????????+ StringUtils.collectionToCommaDelimitedString(missing)); ?????} ???????????????// 如果類加載器中存在對應(yīng)的類的話凡涩,匹配信息進(jìn)行記錄 ?????matchMessage.append("@ConditionalOnClass classes found: " ?????????+ StringUtils.collectionToCommaDelimitedString( ?????????????getMatchingClasses(onClasses, MatchType.PRESENT, context))); ???} ???????// 對@ConditionalOnMissingClass注解做相同的邏輯處理(說明@ConditionalOnClass和@ConditionalOnMissingClass可以一起使用) ???MultiValueMap<String, Object> onMissingClasses = getAttributes(metadata, ???????ConditionalOnMissingClass.class); ???if (onMissingClasses != null) { ?????List<String> present = getMatchingClasses(onMissingClasses, MatchType.PRESENT, ?????????context); ?????if (!present.isEmpty()) { ???????return ConditionOutcome ???????????.noMatch("required @ConditionalOnMissing classes found: " ???????????????+ StringUtils.collectionToCommaDelimitedString(present)); ?????} ?????matchMessage.append(matchMessage.length() == 0 ? "" : " "); ?????matchMessage.append("@ConditionalOnMissing classes not found: " ?????????+ StringUtils.collectionToCommaDelimitedString(getMatchingClasses( ?????????????onMissingClasses, MatchType.MISSING, context))); ???} ???????// 返回全部匹配成功的ConditionalOutcome ???return ConditionOutcome.match(matchMessage.toString()); ?}??private enum MatchType { // 枚舉:匹配類型棒搜。用于查詢類名在對應(yīng)的類加載器中是否存在。????PRESENT { // 匹配成功 ?????@Override ?????public boolean matches(String className, ConditionContext context) { ???????return ClassUtils.isPresent(className, context.getClassLoader()); ?????} ???},????MISSING { // 匹配不成功 ?????@Override ?????public boolean matches(String className, ConditionContext context) { ???????return !ClassUtils.isPresent(className, context.getClassLoader()); ?????} ???};????public abstract boolean matches(String className, ConditionContext context);??}} ???


比如FreemarkerAutoConfiguration中的@ConditionalOnClass注解中有value屬性是freemarker.template.Configuration.class和FreeMarkerConfigurationFactory.class活箕。在OnClassCondition執(zhí)行過程中得到的最終ConditionalOutcome中的log message如下:


[if !supportLists]·?[endif]

1?@ConditionalOnClass?classes?found:?freemarker.template.Configuration,org.springframework.ui.freemarker.FreeMarkerConfigurationFactory


# 基于Bean的條件注解

@ConditionalOnBean(Spring容器中存在指明的bean)力麸、@ConditionalOnMissingBean(Spring容器中不存在指明的bean)以及ConditionalOnSingleCandidate(Spring容器中存在且只存在一個(gè)指明的bean)都是基于Bean的條件注解,它們對應(yīng)的條件類是ConditionOnBean讹蘑。


@ConditionOnBean注解定義如下:

@Target({ ElementType.TYPE, ElementType.METHOD })@Retention(RetentionPolicy.RUNTIME)@Documented@Conditional(OnBeanCondition.class)public @interface ConditionalOnBean { ?Class<?>[] value() default {}; // 匹配的bean類型 ?String[] type() default {}; // 匹配的bean類型的類名 ?Class<? extends Annotation>[] annotation() default {}; // 匹配的bean注解 ?String[] name() default {}; // 匹配的bean的名字 ?SearchStrategy search() default SearchStrategy.ALL; // 搜索策略末盔。提供CURRENT(只在當(dāng)前容器中找)、PARENTS(只在所有的父容器中找座慰;但是不包括當(dāng)前容器)和ALL(CURRENT和PARENTS的組合)} ???


OnBeanCondition條件類的匹配代碼如下:


@Overridepublic ConditionOutcome getMatchOutcome(ConditionContext context, ???AnnotatedTypeMetadata metadata) { ?StringBuffer matchMessage = new StringBuffer(); // 記錄匹配信息 ?if (metadata.isAnnotated(ConditionalOnBean.class.getName())) { ???BeanSearchSpec spec = new BeanSearchSpec(context, metadata, ???????ConditionalOnBean.class); // 構(gòu)造一個(gè)BeanSearchSpec陨舱,會從@ConditionalOnBean注解中獲取屬性,然后設(shè)置到BeanSearchSpec中 ???List<String> matching = getMatchingBeans(context, spec); // 從BeanFactory中根據(jù)策略找出所有匹配的bean ???if (matching.isEmpty()) { // 如果沒有匹配的bean版仔,返回一個(gè)沒有匹配成功的ConditionalOutcome ?????return ConditionOutcome ?????????.noMatch("@ConditionalOnBean " + spec + " found no beans"); ???} ???// 如果找到匹配的bean游盲,匹配信息進(jìn)行記錄 ???matchMessage.append( ???????"@ConditionalOnBean " + spec + " found the following " + matching); ?} ?if (metadata.isAnnotated(ConditionalOnSingleCandidate.class.getName())) { // 相同的邏輯,針對@ConditionalOnSingleCandidate注解 ???BeanSearchSpec spec = new SingleCandidateBeanSearchSpec(context, metadata, ???????ConditionalOnSingleCandidate.class); ???List<String> matching = getMatchingBeans(context, spec); ???if (matching.isEmpty()) { ?????return ConditionOutcome.noMatch( ?????????"@ConditionalOnSingleCandidate " + spec + " found no beans"); ???} ???else if (!hasSingleAutowireCandidate(context.getBeanFactory(), matching)) { // 多了一層判斷蛮粮,判斷是否只有一個(gè)bean ?????return ConditionOutcome.noMatch("@ConditionalOnSingleCandidate " + spec ?????????+ " found no primary candidate amongst the" + " following " ?????????+ matching); ???} ???matchMessage.append("@ConditionalOnSingleCandidate " + spec + " found " ???????+ "a primary candidate amongst the following " + matching); ?} ?if (metadata.isAnnotated(ConditionalOnMissingBean.class.getName())) { // 相同的邏輯益缎,針對@ConditionalOnMissingBean注解 ???BeanSearchSpec spec = new BeanSearchSpec(context, metadata, ???????ConditionalOnMissingBean.class); ???List<String> matching = getMatchingBeans(context, spec); ???if (!matching.isEmpty()) { ?????return ConditionOutcome.noMatch("@ConditionalOnMissingBean " + spec ?????????+ " found the following " + matching); ???} ???matchMessage.append(matchMessage.length() == 0 ? "" : " "); ???matchMessage.append("@ConditionalOnMissingBean " + spec + " found no beans"); ?} ?return ConditionOutcome.match(matchMessage.toString()); //返回匹配成功的ConditonalOutcome} ???


SpringBoot還提供了其他比如ConditionalOnJava、ConditionalOnNotWebApplication然想、ConditionalOnWebApplication莺奔、ConditionalOnResource、ConditionalOnProperty变泄、ConditionalOnExpression等條件注解令哟,有興趣的讀者可以自行查看它們的底層處理邏輯。

# SpringBoot條件注解的激活機(jī)制


分析完了條件注解的執(zhí)行邏輯之后妨蛹,接下來的問題就是SpringBoot是如何讓這些條件注解生效的屏富?


SpringBoot使用ConditionEvaluator這個(gè)內(nèi)部類完成條件注解的解析和判斷。


在Spring容器的refresh過程中蛙卤,只有跟解析或者注冊bean有關(guān)系的類都會使用ConditionEvaluator完成條件注解的判斷狠半,這個(gè)過程中一些類不滿足條件的話就會被skip。這些類比如有AnnotatedBeanDefinitionReader颤难、ConfigurationClassBeanDefinitionReader神年、ConfigurationClassParse、ClassPathScanningCandidateComponentProvider等行嗤。


比如ConfigurationClassParser的構(gòu)造函數(shù)會初始化內(nèi)部屬性conditionEvaluator:

public ConfigurationClassParser(MetadataReaderFactory metadataReaderFactory, ???ProblemReporter problemReporter, Environment environment, ResourceLoader resourceLoader, ???BeanNameGenerator componentScanBeanNameGenerator, BeanDefinitionRegistry registry) {??this.metadataReaderFactory = metadataReaderFactory; ?this.problemReporter = problemReporter; ?this.environment = environment; ?this.resourceLoader = resourceLoader; ?this.registry = registry; ?this.componentScanParser = new ComponentScanAnnotationParser( ?????resourceLoader, environment, componentScanBeanNameGenerator, registry); ?// 構(gòu)造ConditionEvaluator用于處理?xiàng)l件注解 ?this.conditionEvaluator = new ConditionEvaluator(registry, environment, resourceLoader);} ???


ConfigurationClassParser對每個(gè)配置類進(jìn)行解析的時(shí)候都會使用ConditionEvaluator:

if (this.conditionEvaluator.shouldSkip(configClass.getMetadata(), ConfigurationPhase.PARSE_CONFIGURATION)) { ?return;} ???


ConditionEvaluator的skip方法:

public boolean shouldSkip(AnnotatedTypeMetadata metadata, ConfigurationPhase phase) { ?// 如果這個(gè)類沒有被@Conditional注解所修飾瘤袖,不會skip ?if (metadata == null || !metadata.isAnnotated(Conditional.class.getName())) { ???return false; ?} ?// 如果參數(shù)中沒有設(shè)置條件注解的生效階段 ?if (phase == null) { ???// 是配置類的話直接使用PARSE_CONFIGURATION階段 ???if (metadata instanceof AnnotationMetadata && ???????ConfigurationClassUtils.isConfigurationCandidate((AnnotationMetadata) metadata)) { ?????return shouldSkip(metadata, ConfigurationPhase.PARSE_CONFIGURATION); ???} ???// 否則使用REGISTER_BEAN階段 ???return shouldSkip(metadata, ConfigurationPhase.REGISTER_BEAN); ?} ?// 要解析的配置類的條件集合 ?List<Condition> conditions = new ArrayList<Condition>(); ?// 獲取配置類的條件注解得到條件數(shù)據(jù),并添加到集合中 ?for (String[] conditionClasses : getConditionClasses(metadata)) { ???for (String conditionClass : conditionClasses) { ?????Condition condition = getCondition(conditionClass, this.context.getClassLoader()); ?????conditions.add(condition); ???} ?}??// 對條件集合做個(gè)排序 ?AnnotationAwareOrderComparator.sort(conditions); ?// 遍歷條件集合 ?for (Condition condition : conditions) { ???ConfigurationPhase requiredPhase = null; ???if (condition instanceof ConfigurationCondition) { ?????requiredPhase = ((ConfigurationCondition) condition).getConfigurationPhase(); ???} ???// 沒有這個(gè)解析類不需要階段的判斷或者解析類和參數(shù)中的階段一致才會繼續(xù)進(jìn)行 ???if (requiredPhase == null || requiredPhase == phase) { ?????// 階段一致切不滿足條件的話昂验,返回true并跳過這個(gè)bean的解析 ?????if (!condition.matches(this.context, metadata)) { ???????return true; ?????} ???} ?}??return false;} ???


SpringBoot在條件注解的解析log記錄在了ConditionEvaluationReport類中捂敌,可以通過BeanFactory獲取(BeanFactory是有父子關(guān)系的艾扮;每個(gè)BeanFactory都存有一份ConditionEvaluationReport,互不相干):

ConditionEvaluationReport conditionEvaluationReport = beanFactory.getBean("autoConfigurationReport", ConditionEvaluationReport.class);Map<String, ConditionEvaluationReport.ConditionAndOutcomes> result = conditionEvaluationReport.getConditionAndOutcomesBySource();for(String key : result.keySet()) { ???ConditionEvaluationReport.ConditionAndOutcomes conditionAndOutcomes = result.get(key); ???Iterator<ConditionEvaluationReport.ConditionAndOutcome> iterator = conditionAndOutcomes.iterator(); ???while(iterator.hasNext()) { ???????ConditionEvaluationReport.ConditionAndOutcome conditionAndOutcome = iterator.next(); ???????System.out.println(key + " -- " + conditionAndOutcome.getCondition().getClass().getSimpleName() + " -- " + conditionAndOutcome.getOutcome()); ???}} ???


打印出條件注解下的類加載信息:

.......org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration -- OnClassCondition -- required @ConditionalOnClass classes not found: freemarker.template.Configuration,org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryorg.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration -- OnClassCondition -- required @ConditionalOnClass classes not found: groovy.text.markup.MarkupTemplateEngineorg.springframework.boot.autoconfigure.gson.GsonAutoConfiguration -- OnClassCondition -- required @ConditionalOnClass classes not found: com.google.gson.Gsonorg.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration -- OnClassCondition -- required @ConditionalOnClass classes not found: org.h2.server.web.WebServletorg.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration -- OnClassCondition -- required @ConditionalOnClass classes not found: org.springframework.hateoas.Resource,org.springframework.plugin.core.Pluginorg.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration -- OnClassCondition -- required @ConditionalOnClass classes not found: com.hazelcast.core.HazelcastInstance.......

所謂技多不壓身占婉,我們所讀過的每一本書泡嘴,所學(xué)過的每一門語言,在未來指不定都能給我們意想不到的回饋呢逆济。其實(shí)做為一個(gè)開發(fā)者酌予,有一個(gè)學(xué)習(xí)的氛圍跟一個(gè)交流圈子特別重要這里我推薦一個(gè)Java學(xué)習(xí)交流群342016322,不管你是小白還是大牛歡迎入駐奖慌,大家一起交流成長抛虫。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市简僧,隨后出現(xiàn)的幾起案子建椰,更是在濱河造成了極大的恐慌,老刑警劉巖岛马,帶你破解...
    沈念sama閱讀 206,602評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件棉姐,死亡現(xiàn)場離奇詭異,居然都是意外死亡啦逆,警方通過查閱死者的電腦和手機(jī)伞矩,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,442評論 2 382
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來夏志,“玉大人乃坤,你說我怎么就攤上這事」得铮” “怎么了湿诊?”我有些...
    開封第一講書人閱讀 152,878評論 0 344
  • 文/不壞的土叔 我叫張陵,是天一觀的道長溉贿。 經(jīng)常有香客問我枫吧,道長浦旱,這世上最難降的妖魔是什么宇色? 我笑而不...
    開封第一講書人閱讀 55,306評論 1 279
  • 正文 為了忘掉前任,我火速辦了婚禮颁湖,結(jié)果婚禮上宣蠕,老公的妹妹穿的比我還像新娘。我一直安慰自己甥捺,他們只是感情好抢蚀,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,330評論 5 373
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著镰禾,像睡著了一般皿曲。 火紅的嫁衣襯著肌膚如雪唱逢。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,071評論 1 285
  • 那天屋休,我揣著相機(jī)與錄音坞古,去河邊找鬼。 笑死劫樟,一個(gè)胖子當(dāng)著我的面吹牛痪枫,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播叠艳,決...
    沈念sama閱讀 38,382評論 3 400
  • 文/蒼蘭香墨 我猛地睜開眼奶陈,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了附较?” 一聲冷哼從身側(cè)響起吃粒,我...
    開封第一講書人閱讀 37,006評論 0 259
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎翅睛,沒想到半個(gè)月后声搁,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 43,512評論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡捕发,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 35,965評論 2 325
  • 正文 我和宋清朗相戀三年疏旨,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片扎酷。...
    茶點(diǎn)故事閱讀 38,094評論 1 333
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡檐涝,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出法挨,到底是詐尸還是另有隱情谁榜,我是刑警寧澤,帶...
    沈念sama閱讀 33,732評論 4 323
  • 正文 年R本政府宣布凡纳,位于F島的核電站窃植,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏荐糜。R本人自食惡果不足惜巷怜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,283評論 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望暴氏。 院中可真熱鬧延塑,春花似錦、人聲如沸答渔。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,286評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽沼撕。三九已至宋雏,卻和暖如春芜飘,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背磨总。 一陣腳步聲響...
    開封第一講書人閱讀 31,512評論 1 262
  • 我被黑心中介騙來泰國打工燃箭, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人舍败。 一個(gè)月前我還...
    沈念sama閱讀 45,536評論 2 354
  • 正文 我出身青樓招狸,卻偏偏與公主長得像,于是被迫代替她去往敵國和親邻薯。 傳聞我的和親對象是個(gè)殘疾皇子裙戏,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,828評論 2 345

推薦閱讀更多精彩內(nèi)容