Spring Boot/Spring Cloud 104. ʲôÊÇ spring boot£¿
spring boot ÊÇΪ spring ·þÎñµÄ£¬ÊÇÓÃÀ´¼ò»¯Ð spring Ó¦Óõijõʼ´î½¨ÒÔ¼°¿ª·¢¹ý³ÌµÄ¡£ 105. ΪʲôҪÓà spring boot£¿ ÅäÖüòµ¥ ¶ÀÁ¢ÔËÐÐ ×Ô¶¯×°Åä
ÎÞ´úÂëÉú³ÉºÍ xml ÅäÖà ÌṩӦÓüà¿Ø Ò×ÉÏÊÖ ÌáÉý¿ª·¢Ð§ÂÊ
106.spring boot ºËÐÄÅäÖÃÎļþÊÇʲô£¿
spring boot ºËÐĵÄÁ½¸öÅäÖÃÎļþ£º
bootstrap (. yml »òÕß . properties)£ºboostrap Óɸ¸ ApplicationContext ¼ÓÔصģ¬±È applicaton ÓÅÏȼÓÔØ£¬ÇÒ boostrap ÀïÃæµÄÊôÐÔ²»Äܱ»¸²¸Ç£»
application (. yml »òÕß . properties)£ºÓÃÓÚ spring boot ÏîÄ¿µÄ×Ô¶¯»¯ÅäÖᣠ107. spring boot ÅäÖÃÎļþÓÐÄļ¸ÖÖÀàÐÍ£¿ËüÃÇÓÐʲôÇø±ð£¿
ÅäÖÃÎļþÓÐ . properties ¸ñʽºÍ . yml ¸ñʽ£¬ËüÃÇÖ÷ÒªµÄÇø±ðÊÇÊé·¨·ç¸ñ²»Í¬¡£
. properties ÅäÖÃÈçÏ£º spring. RabbitMQ. port=5672 . yml ÅäÖÃÈçÏ£º spring: RabbitMQ: port: 5672
. yml ¸ñʽ²»Ö§³Ö @PropertySource ×¢½âµ¼Èë¡£ 108. spring boot ÓÐÄÄЩ·½Ê½¿ÉÒÔʵÏÖÈȲ¿Êð£¿
ʹÓà devtools Æô¶¯ÈȲ¿Êð£¬Ìí¼Ó devtools ¿â£¬ÔÚÅäÖÃÎļþÖÐ°Ñ spring. devtools. restart. enabled ÉèÖÃΪ true£»
ʹÓà Intellij Idea ±à¼Æ÷£¬¹µÉÏ×Ô¶¯±àÒë»òÊÖ¶¯ÖØбàÒë¡£ 109. jpa ºÍ hibernate ÓÐʲôÇø±ð£¿
jpa È«³Æ Java Persistence API£¬ÊÇ Java ³Ö¾Ã»¯½Ó¿Ú¹æ·¶£¬hibernate ÊôÓÚ jpa µÄ¾ßÌåʵÏÖ¡£ 110. ʲôÊÇ spring cloud£¿
spring cloud ÊÇһϵÁпò¼ÜµÄÓÐÐò¼¯ºÏ¡£ËüÀûÓà spring boot µÄ¿ª·¢±ãÀûÐÔÇÉÃîµØ¼ò»¯ÁË·Ö²¼Ê½ÏµÍ³»ù
´¡ÉèÊ©µÄ¿ª·¢£¬Èç·þÎñ·¢ÏÖ×¢²á¡¢ÅäÖÃÖÐÐÄ¡¢ÏûÏ¢×ÜÏß¡¢¸ºÔؾùºâ¡¢¶Ï·Æ÷¡¢Êý¾Ý¼à¿ØµÈ£¬¶¼¿ÉÒÔÓà spring boot µÄ¿ª·¢·ç¸ñ×öµ½Ò»¼üÆô¶¯ºÍ²¿Êð¡£ 111. spring cloud ¶Ï·Æ÷µÄ×÷ÓÃÊÇʲô£¿
ÔÚ·Ö²¼Ê½¼Ü¹¹ÖУ¬¶Ï·Æ÷ģʽµÄ×÷ÓÃÒ²ÊÇÀàËƵģ¬µ±Ä³¸ö·þÎñµ¥Ôª·¢Éú¹ÊÕÏ£¨ÀàËÆÓõçÆ÷·¢Éú¶Ì·£©Ö®ºó£¬Í¨¹ý¶Ï·Æ÷µÄ¹ÊÕϼà¿Ø£¨ÀàËÆÈ۶ϱ£ÏÕË¿£©£¬Ïòµ÷Ó÷½·µ»ØÒ»¸ö´íÎóÏìÓ¦£¬¶ø²»Êdz¤Ê±¼äµÄµÈ´ý¡£ÕâÑù¾Í²»»áʹµÃÏß³ÌÒòµ÷ÓùÊÕÏ·þÎñ±»³¤Ê±¼äÕ¼Óò»ÊÍ·Å£¬±ÜÃâÁ˹ÊÕÏÔÚ·Ö²¼Ê½ÏµÍ³ÖеÄÂûÑÓ¡£ 112. spring cloud µÄºËÐÄ×é¼þÓÐÄÄЩ£¿ Eureka£º·þÎñ×¢²áÓÚ·¢ÏÖ¡£
Feign£º»ùÓÚ¶¯Ì¬´úÀí»úÖÆ£¬¸ù¾Ý×¢½âºÍÑ¡ÔñµÄ»úÆ÷£¬Æ´½ÓÇëÇó url µØÖ·£¬·¢ÆðÇëÇó¡£ Ribbon£ºÊµÏÖ¸ºÔؾùºâ£¬´ÓÒ»¸ö·þÎñµÄ¶ą̀»úÆ÷ÖÐÑ¡Ôñһ̨¡£
Hystrix£ºÌṩÏ̳߳أ¬²»Í¬µÄ·þÎñ×ß²»Í¬µÄÏ̳߳أ¬ÊµÏÖÁ˲»Í¬·þÎñµ÷ÓõĸôÀ룬±ÜÃâÁË·þÎñÑ©±ÀµÄÎÊÌâ¡£ Zuul£ºÍø¹Ø¹ÜÀí£¬ÓÉ Zuul Íø¹Øת·¢ÇëÇó¸ø¶ÔÓ¦µÄ·þÎñ¡£ Hibernate