1
我曾嘗試使用以下博客 https://www.javacodegeeks.com/2016/07/writing-consuming-soap-webservice-spring.htmlCommandLineRunner和Springboot問題與Hibernate - 無法初始化代理會話 - 沒有會話
端點發佈網址
@Override
public void run(String... arg0) throws Exception {
// TODO Auto-generated method stub Endpoint.p
Endpoint.publish("http://localhost:9000" +"/service/serve", new ServeWeb());
}
創建的春季啓動SOAP服務WebService類是如下
@WebService
public class ServeWeb {
@Autowired
XyzService xyzService;
@WebMethod(operationName="LOGIN")
public List<String> userLogin(
@WebParam(name = "uid")String uid,
@WebParam(name = "pwd")String pwd){
System.out.println("uid == "+uid+"::::: pwd == "+pwd);
List<String> userDetaillist =xyzService.userLogin(uid, pwd);
return userDetaillist;
}
}
在XyzService我使用
@PersistenceContext
private EntityManager em;
我在控制檯收到以下異常
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
的問題是與CommandLinerRunner和Spring引導實體管理器。任何人都可以讓我知道我們如何能夠通過命令行亞軍使用相同的實體管理器