Once David was sitting in the garden — before he was crowned as king — and watched a wasp paralyzing a spider. Amazed by the scene, David who (according to the old sages) was in a constant dialogue with God, asked his creator why he created these useless creatures. The wasp doesn’t just not produce honey, it even sometimes disposes of bees. Or what about the spider? It weaves day and night, but it doesn’t manage to weave a garment. God’s reply was simple: “A day will come, and you shall learn to appreciate those creatures”.
After a while King Sha-ul (Hebrew for Saul) began to envy David’s military success and chased him to arrest him. David escaped to the Plain of Yehuda and hid in a cave. A spider found the cave’s entrance and wove its web in it. Sha-ul arrived at the entrance, noticed the cobweb and said in his heart: “If a person had entered the cave, he would probably have torn the web”.
After King Sha’ul left the cave, David thanked the spider. David finally emerged from the cave, and he was saved.
In the next biblical episode David went to King Sha-ul’s camp in the desert to show him that his defenses can be cracked. David approached and made a move to take Sha-ul’s water canteen, but his army minster moved his heavy feet upon David, preventing him from leaving the tent. But then a wasp appeared and stung the King’s army minister and he moved his foot and David was rescued from danger. David thanked the wasp in his heart, turned to God and said: “I shall never doubt your deeds”.
source : Midrash Alfa-Bieta Ben Sirah