Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6531323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:51:50+00:00 2026-05-25T09:51:50+00:00

Hi I am using Spring 3 + Spring MVC (half of the site) +

  • 0

Hi I am using Spring 3 + Spring MVC (half of the site) + Vaadin + AspectJ + JPA2 + Spring Security

My problem is that Spring creates all my Repositories and I would like to share those with Vaadin using AspectJ injection with Spring Annotations, when vaadin is started (Admin part of the site)

I have managed to make it all working after a couple days, I can use the @Configurable Spring annotation in my Vaadin Controller so It can get auto injected with my Spring context repositories,

BTW I am using Compile-Time weaving with maven, codehaus plugins and AspectJ eclipse plugin so tomcat can get the necessary libs.

BUT…

It sometimes works sometimes doesn’t…

I found that when I add serializable interface to my repos it works, but only If I ask to generate the serialId and then run the app (tomcat) right after it, if I make any changes and build it again, injection is gone.

My config and Classes…

part that I think matters of my applicationContext.xml

   .
   .
   Other stuff

    <context:spring-configured />
    <context:component-scan base-package="br.com.gsc" />
    <mvc:annotation-driven />
    <tx:annotation-driven transaction-manager="transactionManager"/>

   .
   .
   Other stuff

here is the Vaadin Servlet

package br.com.gsc.vaadin;

import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;

import br.com.gsc.model.tableMapping.Person;
import br.com.gsc.repository.objRepos.PersonRepository;

import com.vaadin.Application;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Window;


@Configurable(preConstruction=true,autowire=Autowire.BY_TYPE)
public class VaadinOperatorServlet extends Application {


/**
     * 
     */
    private static final long serialVersionUID = -1481084776783567319L;

    @Autowired
    private transient PersonRepository pRepo;

    public void init() {
        createWindow();
    }

    public void createWindow(){
        Window window = new Window();
        Panel p = new Panel();
        Label l = new Label("Teste");
        Label l2 = new Label("");
        Label l3 = new Label("");

        Person person = pRepo.findPersonByID("user");
        l2 = new Label(person.getUsername());
        p.addComponent(l);
        p.addComponent(l2);
        window.addComponent(p);
        setMainWindow(window);
        window.getContent().setSizeFull();  
    }
}

My Repo

package br.com.gsc.repository.objRepos;

import java.io.Serializable;
import java.util.List;

import org.springframework.stereotype.Repository;

import br.com.gsc.model.tableMapping.Person;
import br.com.gsc.repository.AbsRepository;
import br.com.gsc.repository.objInterfaces.IPersonRepository;

@Repository
public class PersonRepository extends AbsRepository<Person> implements IPersonRepository,Serializable{

    /**
     * 
     */
    private static final long serialVersionUID = -8520715359024018210L;

    @Override
    public void addPerson(Person t) {
        add(t);
    }

    Lot's of other stuff....



}

Web.xml with the servlet routings and other stuff.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>GSC</display-name>
    <welcome-file-list>
        <welcome-file>/intern.html</welcome-file>
    </welcome-file-list>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

      <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
      </listener>

<!-- Vaadin production mode -->
    <context-param>
        <param-name>productionMode</param-name>
        <param-value>false</param-value>
    </context-param>

<!--    SERVLETS     -->
    <servlet>
        <servlet-name>spring</servlet-name>
        <servlet-class>
            org.springframework.web.servlet.DispatcherServlet
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>    
    <servlet>
        <servlet-name>vaadinServlet</servlet-name>
        <servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
        <init-param>
            <param-name>application</param-name>
            <param-value>br.com.gsc.vaadin.VaadinOperatorServlet</param-value>
        </init-param>
        <init-param>
            <description>Application widgetset</description>
            <param-name>widgetset</param-name>
            <param-value>br.com.gsc.vaadin.widgetset.GscWidgetset</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

<!--    SERVLET MAPPINGS -->
    <servlet-mapping>
        <servlet-name>vaadinServlet</servlet-name>
        <url-pattern>/admin/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>vaadinServlet</servlet-name>
        <url-pattern>/oper/*</url-pattern>
    </servlet-mapping>   
    <servlet-mapping>
          <servlet-name>vaadinServlet</servlet-name>
          <url-pattern>/VAADIN/*</url-pattern>
    </servlet-mapping> 
    <servlet-mapping>
        <servlet-name>spring</servlet-name>
        <url-pattern>*.html</url-pattern>
    </servlet-mapping>        

<!--  Filter OpenSession     -->   
    <filter>  
      <filter-name>openEntityManager</filter-name>   
      <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>   
    </filter>  
    <filter-mapping>  
      <filter-name>openEntityManager</filter-name>   
      <url-pattern>/*</url-pattern>   
    </filter-mapping>  
<!--  Filter OpenSession  -->

    <!--  Filter Security  -->
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <!--  Filter Security -->

    <!-- Filter HTTP Methods -->
    <filter>
        <filter-name>httpMethodFilter</filter-name>
        <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>httpMethodFilter</filter-name>
        <servlet-name>spring</servlet-name>
    </filter-mapping>
    <!-- Filter HTTP Methods -->
</web-app>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:51:51+00:00Added an answer on May 25, 2026 at 9:51 am

    Well I could not fix it by any means…

    I finally used Spring roo to build a maven web app and pasted all my codes and configs there, because I knew Roo worked out of the box with Aspects.

    It’s now working… but I have no clue why my last project had that issue with DI outside Spring Context.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Spring MVC and Spring Security 3. My problem is, that if I
I'm using spring MVC, and I have a custom authentication/security system that I had
we're using Spring MVC with Spring security. One of the requirements is that if
I'm using spring-security web authentication with spring-mvc, all is well so far, but now
I'm using Spring's form tag library in a Spring MVC application that I am
I'm currently migrating a project that is using Spring MVC without annotations to Spring
I am using spring mvc. I have 3 pages in my site (actually the
I am using Spring MVC and Spring Security version 3.0.6.RELEASE. What is the easiest
I am using spring mvc and spring security. In my security-app-context.xml I have: <authentication-manager>
I am using Spring MVC's charset filter. This is the URL that I use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.