Spouses have rights but try naming your estate for 1/2 if you don't want the spouse to get all And do a will designating the beneficiary for the other 1/2.
Ca is a community property estate and I will assume that your 401K like most is a community asset. In that scenario you can not will away all of your 401K to someone other than your spouse.
Disclaimer: The above answer does not create an attorney/client relationship. My responses are intended to provide general information about the question posted. I am licensed to practice in the state of California and Texas. The information provided on this site should not be used as a substitute for conferring with or hiring a competent legal advice from a licensed attorney that practices in the subject area in your state.