Skip to content

Commit 0402ea1

Browse files
committed
Merge branch '6.1.x'
2 parents 6682d75 + 09b476a commit 0402ea1

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,16 @@ else if (requiredType != null) {
315315
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
316316
"'" + beanName + "' depends on missing bean '" + dep + "'", ex);
317317
}
318+
catch (BeanCreationException ex) {
319+
if (requiredType != null) {
320+
// Wrap exception with current bean metadata but only if specifically
321+
// requested (indicated by required type), not for depends-on cascades.
322+
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
323+
"Failed to initialize dependency '" + ex.getBeanName() + "' of " +
324+
requiredType.getSimpleName() + " bean '" + beanName + "'", ex);
325+
}
326+
throw ex;
327+
}
318328
}
319329
}
320330

spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ protected void finishBeanFactoryInitialization(ConfigurableListableBeanFactory b
957957
// Initialize LoadTimeWeaverAware beans early to allow for registering their transformers early.
958958
String[] weaverAwareNames = beanFactory.getBeanNamesForType(LoadTimeWeaverAware.class, false, false);
959959
for (String weaverAwareName : weaverAwareNames) {
960-
getBean(weaverAwareName);
960+
beanFactory.getBean(weaverAwareName, LoadTimeWeaverAware.class);
961961
}
962962

963963
// Stop using the temporary ClassLoader for type matching.

spring-web/src/main/java/org/springframework/http/converter/ResourceRegionHttpMessageConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ public boolean canWrite(@Nullable Type type, @Nullable Class<?> clazz, @Nullable
104104
}
105105

106106
@Override
107-
@SuppressWarnings("unchecked")
108107
protected void writeInternal(Object object, @Nullable Type type, HttpOutputMessage outputMessage)
109108
throws IOException, HttpMessageNotWritableException {
110109

111110
if (object instanceof ResourceRegion resourceRegion) {
112111
writeResourceRegion(resourceRegion, outputMessage);
113112
}
114113
else {
114+
@SuppressWarnings("unchecked")
115115
Collection<ResourceRegion> regions = (Collection<ResourceRegion>) object;
116116
if (regions.size() == 1) {
117117
writeResourceRegion(regions.iterator().next(), outputMessage);

spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilderTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,20 +864,21 @@ public Savepoint getBooking(@PathVariable Long booking) {
864864
}
865865
}
866866

867+
867868
interface HelloInterface {
868869

869870
@GetMapping("/hello/{name}")
870871
ResponseEntity<String> get(@PathVariable String name);
871872
}
872873

874+
873875
@Controller
874876
static class HelloController implements HelloInterface {
875877

876878
@Override
877879
public ResponseEntity<String> get(String name) {
878880
return ResponseEntity.ok("Hello " + name);
879881
}
880-
881882
}
882883

883884
}

0 commit comments

Comments
 (0)