Dreams are uniquely tailored to deal with situations at hand. After the wise men met Herod and never return, but left using another way, he embarked on a plan to just kill all the babies who were two years old or younger.
Now, before the killing of those babies began, God guided Joseph by means of a dream. In Matthew 2:13-14 the Bible says, “And when they were departed, behold, the angel of the Lord appeareth to Joseph in a dream, saying, Arise, and take the young child and his mother, and flee into Egypt, and be thou there until I bring thee word: for Herod will seek the young child to destroy him. When he arose, he took the young child and his mother by night, and departed into Egypt” (KJV). In these Scripture verses we see that an angel appeared to Joseph in a dream. Joseph responded to the dream that night by taking off for Egypt.
Angels have in the past appeared to people in dreams. One of the people the Bible talks about is Jacob. Jacob in a dream saw a ladder that reached into heaven and Angels were going up and down on it. In Genesis 28: 12 the Bibles says, “And he dreamed, and behold a ladder set up on the earth, and the top of it reached to heaven: and behold the angels of God ascending and descending on it” (KJV). After that experience Jacob vowed to give his tithe to God.
At the beginning of Solomon reign, God himself appeared to Solomon in a dream. In 1 Kings 3:5 we are told, “In Gibeon the Lord appeared to Solomon in a dream by night: and God said, Ask what I shall give thee” (KJV). Due to what happened, Solomon ended up praying while dreaming. He prayed for a discerning heart so that he could govern the people well and God was pleased with his response and blessed him with wisdom.
In 1Kings 3:15 the Bible says, “And Solomon awoke; and, behold, it was a dream. And he came to Jerusalem, and stood before the ark of the covenant of the Lord, and offered up burnt offerings, and offered peace offerings, and made a feast to all his servants” (KJV). Solomon responded to the dream he had by going to the house of God to give offerings and celebrate. Solomon responded in faith.