what is better java backend vs data engineer

I studied web security and discovered some vulnerabilities in famous sites and earned some money$$ then moved to learn php then left it and moved to java spring because I think it is better for working in institutions and less noticeable competition I don't have much information I am at the beginning of the road

Currently I am afraid of the development of artificial intelligence and I thought about moving to the field of data, for example data engineering. What do you think? Is it better? For example, in the future, salary and job

Or should I complete the path in spring