Springboot集成cas

pom添加依赖
很关键

<dependency>
    <groupId>net.unicon.cas</groupId>
    <artifactId>cas-client-autoconfig-support</artifactId>
    <version>1.4.0-GA</version>
    <exclusions>
        <exclusion>
            <groupId>org.jasig.cas.client</groupId>
            <artifactId>cas-client-core</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>org.jasig.cas.client</groupId>
    <artifactId>cas-client-core</artifactId>
    <version>3.5.0</version>
</dependency>

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>5.3.0.Final</version>
</dependency>

不加下面这个jar会报错

org.hibernate
hibernate-validator
5.3.0.Final

构建简单的SpringBoot项目时,在启动项目的时候发现如下错误:
Description:
The Bean Validation API is on the classpath but no implementation could be found
Action:
Add an implementation, such as Hibernate Validator, to the classpath

意思是Bean的校验API在classpath中没有找到实现的类。建议添加一个Validation 的实现,比如在classpath下添加一个Hibernate Validator的实现。 因为使用了 @EnableAutoConfiguration 注解,Spring则可能会尝试寻找一个关于Java specification for Bean Validation的实现 (更多详情请见: spring validation).

解决方案: 添加一个Hibernate Validator依赖实现。
在POM中添加

然后启动类上面

@EnableCasClient//开启cas
举个栗子 :
@SpringBootApplication
//@PropertySource(value={“classpath:config/path.properties”},ignoreResourceNotFound=true,encoding=”utf-8”)
//@ImportResource(“classpath:spring/*.xml”)
//@EnableAspectJAutoProxy(proxyTargetClass = true,exposeProxy = true)
@EnableCasClient//开启cas
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

完成cas集成

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值