草庐IT

creating-a-no-hypervisor-boot-ent

全部标签

java - Spring Boot JPA - OneToMany 关系导致无限循环

我有两个具有简单@OneToMany关系的对象,如下所示:parent:@EntitypublicclassParentAccount{@Id@GeneratedValueprivatelongid;privateStringname;@OneToMany(fetch=FetchType.EAGER,mappedBy="parentAccount")privateSetlinkedAccounts;}child:@EntitypublicclassLinkedAccount{@Id@GeneratedValueprivatelongid;@ManyToOne(optional=fals

java - 在 Controller 中获取 Spring boot/security 的 session token

我们正在使用带有springsecurity的springboot来实现一个查询接口(interface)。我想要做的是只允许每个用户一次运​​行固定数量的查询。查询可能需要很长时间,用户发送重复请求的速度可能快于我们的响应速度。我希望Controller一次只计算一个子集请求,并且我必须实现一些逻辑来确定要响应哪些请求。为此,我需要知道给定用户的sessiontoken。有没有一种简单的方法可以在Controller的方法中获取它? 最佳答案 如果你想在Controller中获取sessionId,你可以使用RequestCont

java - Spring-Boot 在 WAR 文件中找不到 JSP 页面

运行spring-boot项目时(java-jar/path/to/war.war)找不到.jsp文件。用@ResponseBody注释的方法工作正常。View解析器正在提供JSP页面的正确路径,但找不到它们。本项目只有一个配置类,没有web.xml。配置类:@Configuration@EnableAutoConfiguration@EnableWebMvc@ComponentScan(basePackages="org.ghc.security.web")classScMainextendsWebMvcConfigurerAdapter{//SpringBootBootStrap.

java - Spring Boot 应用程序在启动时终止

我正在尝试一个简单的springboot应用程序,它总是自动关闭::SpringBoot::(v1.4.1.RELEASE)2016-10-2313:05:21.681INFO16532---[main]com.example.RestBootApplication:Noactiveprofileset,fallingbacktodefaultprofiles:default2016-10-2313:05:21.766INFO16532---[main]s.c.a.AnnotationConfigApplicationContext:Refreshingorg.springframew

java - 带有 Spring Boot REST 应用程序的 OAuth2 - 无法使用 token 访问资源

我想为我的RESTspringboot项目使用OAuth2。使用一些示例,我为OAuth2创建了配置:@ConfigurationpublicclassOAuth2Configuration{privatestaticfinalStringRESOURCE_ID="restservice";@Configuration@EnableResourceServerprotectedstaticclassResourceServerConfigurationextendsResourceServerConfigurerAdapter{@Overridepublicvoidconfigure(

java - 在 Spring Boot 中为 @WebMvcTest 禁用 Spring Security 配置类

最近我使用以下类将SpringSecurity添加到我的SpringBoot项目中:@EnableWebSecurity@EnableGlobalMethodSecurity(prePostEnabled=true)publicclassMySecurityConfig{}因此,默认情况下,我的所有URL现在都受到身份验证和自行生成的密码的保护。问题是我用于对Controller进行单元测试的@WebMvcTest类中的所有测试:@RunWith(SpringRunner.class)@WebMvcTest(SomeController.class)publicclassSomeCon

java - Maven Spring Boot 无法实例化 SLF4J LoggerFactory 报告异常 :

我正在学习教程https://spring.io/guides/gs/actuator-service/当我尝试运行应用程序时,我得到:FailedtoinstantiateSLF4JLoggerFactoryReportedexception:java.lang.NoClassDefFoundError:ch/qos/logback/core/joran/spi/JoranExceptionatorg.slf4j.LoggerFactory.bind(LoggerFactory.java:150)atorg.slf4j.LoggerFactory.performInitializat

java - 异常获取服务器实例 : No valid instance id for this instance

当我在我的本地主机GoogleAppEngine应用程序中将日志记录级别更改为FINE时,我开始在我的跟踪堆栈中看到这些:Apr17,20134:54:20PMcom.google.appengine.tools.development.DevAppServerServersFiltergetCurrentServerInstanceFINE:Exceptiongettingserverinstancecom.google.appengine.api.labs.servers.ServersException:Novalidinstanceidforthisinstance.atcom

google-app-engine - App Engine 批量加载程序下载警告 "No descending index on __key__, performing serial download"

我正在使用以下内容下载我的一种的所有实例:appcfg.pydownload_data--config_file=bulkloader.yaml--kind=ModelName--filename=ModelName.csv--url=http://appid.appspot.com/remote_api如果种类的实例数多于批量大小,那么我会收到此警告:Nodescendingindexon__key__,performingserialdownload我没有任何自定义索引,也没有任何禁用索引的属性。我“需要”做些什么来解决这个警告,还是它只是一个我可以放心忽略的警告?会影响下载速度吗

java - 以 @ConfigurationProperties 为条件的 Spring Boot

我有一个身份验证服务,我想在运行时自动配置它,但它会被模拟用于开发和测试。我想使用@ConfigurationProperties功能来定义必要的参数,但我还需要能够有条件地创建AuthenticationManager实例,具体取决于实时服务是否已配置。我想采用的方法是使用类似@ConditionalOnBean(AuthProperties.class)的方法,但是SpringBoot会创建我的@ConfigurationProperties类的bean,而不管这些属性是否存在。我可以对字段应用验证注释,但如果未配置实时服务,则上下文根本不会启动。是否有一种干净的方法可以使配置部分