|
@ -40,8 +40,6 @@ public class BeanConfig {
|
|
|
@Autowired
|
|
|
BasicDataSource dataSource;
|
|
|
|
|
|
@Value("${hos.zbus.url}")
|
|
|
private String zbusUrl;
|
|
|
@Value("${hos.zbus.port}")
|
|
|
private Integer zbusPort;
|
|
|
@Value("${hos.zbus.store}")
|
|
@ -52,7 +50,7 @@ public class BeanConfig {
|
|
|
@Bean
|
|
|
public ZbusBroker getZbusBroker() {
|
|
|
try {
|
|
|
zbusBroker = new ZbusBroker(this.zbusUrl);
|
|
|
zbusBroker = new ZbusBroker("127.0.0.1:" + zbusPort);
|
|
|
return zbusBroker;
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
@ -60,10 +58,6 @@ public class BeanConfig {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public String getZbusUrl() {
|
|
|
return zbusUrl;
|
|
|
}
|
|
|
|
|
|
public Integer getZbusPort() {
|
|
|
return zbusPort;
|
|
|
}
|
|
@ -72,16 +66,6 @@ public class BeanConfig {
|
|
|
return zbusStore;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected void finalize() throws Throwable {
|
|
|
if (zbusBroker != null) {
|
|
|
zbusBroker.close();
|
|
|
}
|
|
|
|
|
|
super.finalize();
|
|
|
}
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
public LocalSessionFactoryBean sessionFactory() {
|
|
|
LocalSessionFactoryBean localSessionFactoryBean = new LocalSessionFactoryBean();
|
|
@ -100,6 +84,15 @@ public class BeanConfig {
|
|
|
return localSessionFactoryBean;
|
|
|
}
|
|
|
|
|
|
//txManager事务开启
|
|
|
@Bean
|
|
|
public HibernateTransactionManager txManager() throws SQLException {
|
|
|
HibernateTransactionManager hibernateTransactionManager = new HibernateTransactionManager();
|
|
|
LocalSessionFactoryBean sessionFactoryBean = this.sessionFactory();
|
|
|
hibernateTransactionManager.setSessionFactory(sessionFactoryBean.getObject());
|
|
|
return hibernateTransactionManager;
|
|
|
}
|
|
|
|
|
|
// @Bean( destroyMethod = "close")
|
|
|
// public BasicDataSource dataSource() {
|
|
|
// if (StringUtils.isEmpty(datasourcePropertyResolver.get("url").toString())) {
|
|
@ -123,15 +116,6 @@ public class BeanConfig {
|
|
|
// return dataSource;
|
|
|
// }
|
|
|
|
|
|
//txManager事务开启
|
|
|
@Bean
|
|
|
public HibernateTransactionManager txManager() throws SQLException {
|
|
|
HibernateTransactionManager hibernateTransactionManager = new HibernateTransactionManager();
|
|
|
LocalSessionFactoryBean sessionFactoryBean = this.sessionFactory();
|
|
|
hibernateTransactionManager.setSessionFactory(sessionFactoryBean.getObject());
|
|
|
return hibernateTransactionManager;
|
|
|
}
|
|
|
|
|
|
//文经上传
|
|
|
@Bean
|
|
|
public CommonsMultipartResolver multipartResolver() {
|
|
@ -147,7 +131,6 @@ public class BeanConfig {
|
|
|
return messageSource;
|
|
|
}
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
public CookieLocaleResolver localeResolver() {
|
|
|
CookieLocaleResolver localeResolver = new CookieLocaleResolver();
|
|
@ -188,4 +171,13 @@ public class BeanConfig {
|
|
|
return new AuditInterceptor();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected void finalize() throws Throwable {
|
|
|
if (zbusBroker != null) {
|
|
|
zbusBroker.close();
|
|
|
}
|
|
|
|
|
|
super.finalize();
|
|
|
}
|
|
|
|
|
|
}
|