Prioritizing execution order of JUNIT test classes [closed]

I have two individual test classes ( for example : TestClassA, TestClassB) I want TestClassA to run first and TestClassB to run next. How can i do so. Any ideas.

Note that i am using Springboot here and my test dependency is : spring-boot-starter-test


you can do using junit 5

public void firstTest() {

public void secondTest() {

check refence here

and for different classes use test suite

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

@SuiteClasses({ TestClass1.class, TestClass2.class })
public class AllTests {