ureport集成
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package com.ktg;
|
||||
|
||||
import com.bstek.ureport.console.UReportServlet;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
||||
@@ -11,6 +15,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableAsync
|
||||
@ImportResource("classpath:ureport-console-context.xml")
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class RuoYiApplication
|
||||
{
|
||||
@@ -18,15 +23,13 @@ public class RuoYiApplication
|
||||
{
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication.run(RuoYiApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
" | |\\ \\ | || |(_,_)' \n" +
|
||||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
System.out.println("(♥◠‿◠)ノ゙ KTM-MES启动成功 ლ(´ڡ`ლ)゙ \n");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean urportServlet(){
|
||||
ServletRegistrationBean bean = new ServletRegistrationBean(new UReportServlet());
|
||||
bean.addUrlMappings("/ureport/*");
|
||||
return bean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.ktg.web.core.config;
|
||||
|
||||
import com.bstek.ureport.definition.datasource.BuildinDatasource;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@Configuration
|
||||
public class UReportConfig implements BuildinDatasource {
|
||||
|
||||
@Resource
|
||||
DataSource dataSource;
|
||||
|
||||
/**
|
||||
* 返回数据源的名称
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String name() {
|
||||
return "内置数据源";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection() {
|
||||
try {
|
||||
return dataSource.getConnection();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("连接数据源失败!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user