It was governed by a prince-bishop until 1802 . It became a part of Bavaria in 1806 . The city was chartered in 908 and ruled by a prince-bishop until secularization in 1802 , and became a part of Bavaria in 1806 .