草庐IT

spring-core

全部标签

java - Controller 中所有方法的 Spring AOP 切入点

我想在Spring(3.2.3)@Controller中的每个方法之前运行一些代码。我定义了以下但它不会运行。我怀疑切入点表达式不正确。调度器-servlet.xmlc.e.w.c.ThingAspect@Pointcut("execution(com.example.web.controllers.ThingController.*(..))")publicvoidthing(){}@Before("thing()")publicvoiddoStuffBeforeThing(JoinPointjoinPoint){//dostuffhere} 最佳答案

java - Spring 警告 : Request method 'HEAD' not supported

在tomcat7上成功部署后,我每秒收到警告消息:org.springframework.web.servlet.PageNotFoundhandleHttpRequestMethodNotSupportedWARNING:Requestmethod'HEAD'notsupported但是application作品。如何避免这个烦人的消息? 最佳答案 您需要在失败的方法上添加以下@RequestMapping(method={RequestMethod.GET,RequestMethod.HEAD})。这将允许他们处理HEAD请求并

java - 使用 Spring Security Filter 锁定除少数路由之外的所有内容

我们正在重新设计我们的产品以删除SpringSecurity中默认的“anonymousUser”行为,并希望锁定除少数端点之外的所有URL(通过过滤器安全性)。我们想不通的是如何指定“锁定除X、Y和Z之外的所有内容”我们的安全设置基本上归结为以下内容:@ConfigurationpublicclassSecurityConfigextendsWebSecurityConfigurerAdapter{@Overrideprotectedvoidconfigure(HttpSecurityhttp)throwsException{http//disableanonymoususers.a

java - Unresolved 要求 : Require-Bundle: org. eclipse.core.databinding.beans;捆绑版本 ="1.2.200"

我正在尝试创建一个RCP应用程序,我想在其中绑定(bind)一个来自bean的变量以进行查看。bean的代码#publicclassSaveFileBeanimplementsPropertyChangeListener{privateStringtext;privatePropertyChangeSupportpropertyChangeSupport=newPropertyChangeSupport(this);@OverridepublicvoidpropertyChange(PropertyChangeEventarg0){propertyChangeSupport.fireP

java - 如何在 Eclipse tomcat 中运行 spring boot 应用程序?

我有一个SpringBoot应用程序,想在Eclipse中将其作为服务器应用程序运行。因此,该应用程序将被识别为Tomcat网络应用程序,并且可以添加我更新方面:当我运行网络应用程序时,我的其余服务未被发现。SpringBoot应用程序包含的文件夹结构与SpringBoot发布之前的Spring应用程序不同。可以从配置为eclipse的tomcat运行springboot应用程序吗?同样在springboot之前,需要指定应用程序的Controller部分。我是否需要使用这些设置更新我的springboot应用程序才能从Eclipsetomcat运行?我不想创建一个war,然后将它复制

java - spring security - 在 UserDetailsS​​ervice 实现中访问请求参数

我正在开发一个javaspringmvc应用程序。我已经像这样实现了UserDetailsS​​ervice接口(interface):@Component@TransactionalpublicclassSecurityDAOimplementsUserDetailsService{@OverridepublicUserDetailsloadUserByUsername(finalStringusername)throwsUsernameNotFoundException{...}....}我需要在loadUserByUsername方法中找到用户登录url(因为该项目有多个登录ur

如何将.NET 8.0的ASP.NET Core Web API部署成Windows服务

写在前面前面写了一篇关于将.NET应用转换成Windows服务的方法,其实真正的目的是为了探索如何将Asp.NetCoreWebApi部署成Windows服务。基于上一篇的基础,只需把创建WebApplication的代码放到 BackgroundService的ExecuteAsync方法中即可。其中比较重要的一个细节就是需要指定一下配置:    host.ConfigureAppConfiguration((hostingContext,config)=>{      config.AddJsonFile("appsettings.json",optional:true,reloadOnC

java - Spring Security >5.0.0 移除了 Md5PasswordEncoder

我有一个使用Spring安全性的Spring项目。我之前使用的是SpringBoot1.5,现在迁移到了SpringBoot2.0。我注意到Md5PasswordEncoder已在SpringSecurity的最终版本中删除。相反,即使已弃用(https://docs.spring.io/spring-security/site/docs/5.0.3.RELEASE/api/),Md4PasswordEncoder仍然存在。我应该使用外部MD5编码器还是将分类移动到其他地方? 最佳答案 Md5PasswordEncoder不复存在的

java - Spring Injection - 在构造函数中访问注入(inject)的对象

我有一个资源(Springbean),它的一些字段由Spring注入(inject),例如:@Repository(value="appDao")publicclassAppDaoImplimplementsAppDao{@PersistenceContextEntityManagerentityManager;publicResource(){...useentityManager...//doesn'twork}}我知道我无法在构造函数中访问注入(inject)的entityManager,应该在不同的方法上使用@PostConstruct注释。但是这是什么原因呢?

java - Spring WS DefaultWsdl11定义错误

我正在使用SpringWS并声明一个DefaultWsdl11Definitionbean以动态生成W​​SDL文件。但是,当我启动网络服务器(tomcat)时,由于以下原因出现bean实例化错误:Causedby:org.springframework.beans.BeanInstantiationException:Couldnotinstantiatebeanclass[org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition]:Constructorthrewexception;nestedexceptionisjav