Spring Boot soap + hibernate配置

时间:2016-09-05 21:15:50

标签: spring hibernate soap

我已经有一个肥皂用弹簧靴了。

我现在怀疑它如何在WebAppInitializer文件中添加注入Hibernate。

我的档案现在就像这样

public class WebAppInitializer implements WebApplicationInitializer {

    public void onStartup(ServletContext servletContext) throws ServletException {  
        AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();  
        ctx.register(AppConfig.class);  
        ctx.setServletContext(servletContext);    
        MessageDispatcherServlet servlet = new MessageDispatcherServlet();
        servlet.setApplicationContext(ctx);
        servlet.setTransformWsdlLocations(true);
        Dynamic dynamic = servletContext.addServlet("dispatcher",servlet);  
        dynamic.addMapping("/soapws/*");  
        dynamic.setLoadOnStartup(1);  
    }  
} 

任何人都可以告诉我如何添加hibernate配置/注入

先谢谢

1 个答案:

答案 0 :(得分:0)

您可以使用spring boot starter jpa。在pom.xml中包含以下依赖项(如果使用maven)。

dispatch_async(dispatch_get_main_queue() 

然后,在application.properties中指定hibernate选项。例如,

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

Spring Boot会根据找到的@EnableAutoConfiguration尝试猜测@Entity定义的位置。要获得更多控制,可以使用@EntityScan注释 有关详细信息,请参阅此处:

http://docs.spring.io/spring-boot/docs/current/reference/html/howto-data-access.html