Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Spring
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Spring
Spring MVC and application context
Maiquel knechtel
Greenhorn
Posts: 12
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Spring MVC application web needs application-context for getting @Bean annotations?
in my project i use this code:
import org.springframework.web.WebApplicationInitializer; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; public class WebInitializer implements WebApplicationInitializer { public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(Config.class); ctx.setServletContext(servletContext); Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); } }
how i configure @Bean annotations on spring without application-Context, it is possible ?
K. Tsang
Bartender
Posts: 3648
16
I like...
posted 9 years ago
1
Number of slices to send:
Optional 'thank-you' note:
Send
Did you try adding @Bean annotation to the class? Did it compile/deploy? Did it run? If not, what's the exception/error?
K. Tsang CEng MBCS PMP PMI-ACP OCMJEA OCPJP
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
406 Error
Spring MVC JPA problems
[MVC]Why in this example I have to use annotation-driven tag? Difference beetwen component-scan
How to add a new tag in XML configuration file.
Integration testing of Spring 2.5 Annotation based controller using web context
More...