我已经使用以下博客在Spring-boot中创建了肥皂服务https://www.javacodegeeks.com/2016/07/writing-consuming-soap-webservice-spring.html
端点发布url
@Override
public void run(String... arg0) throws Exception {
// TODO Auto-generated method stub Endpoint.p
Endpoint.publish("http://localhost:9000" +"/service/serve", new ServeWeb());
}
网络服务类如下
@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 Boot Entity Manager。谁能让我知道我们如何通过命令行跑步者使用相同的实体经理
我很喜欢解决方案,我在xyzservice上使用了spring注释 @transactional,它对我有用。