@Component public class MyClass { } ApplicationContext context = new AnnotationConfigApplicationContext(ApplicationConfig.class); MyClass myObject = context.getBean(MyClass.class); myObject.doSomething(); @Entity public class Employee { } SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); Employee employee = new Employee(); session.save(employee); tx.commit(); session.close(); import org.apache.commons.lang3.StringUtils; String str = "Hello, world!"; int length = StringUtils.length(str); System.out.println("Length: " + length);


上一篇:
下一篇:
切换中文