Yes, all your talents will remain when you change your spec in WoW Dragonflight. For example, you can easily switch between your tank and healer spec without resetting your talents. Also, for each specialization, the order of your abilities in the action bar remains. So you can switch back and forth as often as you like.