我想使用没有覆盖的cas服务器,这是我的尝试。我在编译时找到了类: org.apereo.cas.web.CasWebApplication,但是它已经在依赖项中了(cas-server-webapp-init)。Class.forname工作得很好,但是我想知道如何使用没有覆盖的cas。
@SpringBootApplication
public class CasServerApplication {
public static void main(String[] args) {
org.apereo.cas.web.CasWebApplication.main(args);
/* But the following code works fine
Class<?> clazz = Class.forName("org.apereo.cas.web.CasWebApplication");
Method method = clazz.getMethod("main", String[].class);
method.invoke(null, (Object) args);
*/
}
}<packaging>jar</packaging>
<description>cas-server</description>
<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>2.5.4</spring-boot.version>
<cas.version>6.4.5</cas.version>
<log4j.version>2.17.1</log4j.version>
</properties>
<dependencyManagement>
... spring-boot, log4j, cas-server-support-bom
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-webapp-init-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-core-web-api</artifactId>
</dependency>
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-core-util-api</artifactId>
</dependency>
</dependencies>发布于 2022-01-21 12:54:12
如果您添加了所需的cas核心依赖项,则可以直接命名您创建的类(即SpringApplication.run(CasServerApplication.class,args),而不是在entrypoint类中命名CasWebApplication。
就像你一样,我想使用没有覆盖模板的cas服务器,并且我已经创建了一个替代模板。你可以从https://github.com/dgempiuc/cas-template结帐
https://stackoverflow.com/questions/70783816
复制相似问题